MODX Community

Using XRouting for Multi-Domains Issue

I have a site that has multi-contexts. They are working great and as they should be. I have recently added a domain and pointed it to the modxcloud location. I setup another context and added the information needed with the http_host being that domains host. Is there anything additional I need to do? I assumed a domain would work right away, haven’t really had issues before with subdomains.

All I get is “Page Not Found”. And it’s not my 404 page I have setup on the other hosts, it’s the default standard message.

Modx 2.7.0
XRouting

Results for Debug:

## MODX context map:
Array

[_hosts] => Array
        [onesourcevirtual.us] => Array
            (
                [0] => web
                [1] => en-gb
                [2] => de
                [3] => careers
            )
        [osvrpaas.com] => Array
                [0] => rpaas

[web] => Array
        [base_url] => /
        [cultureKey] => web
        [http_host] => onesourcevirtual.us
        [site_start] => 1
        [site_url] => https://www.onesourcevirtual.us/

[rpaas] => Array
        [base_url] => /
        [cultureKey] => rpaas
        [http_host] => osvrpaas.com
        [site_start] => 443
        [site_url] => https://www.osvrpaas.com/

[en-gb] => Array
        [base_url] => /en-gb/
        [cultureKey] => en-gb
        [http_host] => onesourcevirtual.us
        [site_start] => 14
        [site_url] => https://www.onesourcevirtual.us/en-gb/

[de] => Array
        [base_url] => /de/
        [cultureKey] => de
        [http_host] => onesourcevirtual.us
        [site_start] => 18
        [site_url] => https://www.onesourcevirtual.us/de/

[careers] => Array
        [base_url] => /careers/
        [cultureKey] => careers
        [http_host] => onesourcevirtual.us
        [site_start] => 171
        [site_url] => https://www.onesourcevirtual.us/careers/

## Requested URL: 
## Requested URL with base_url: /
## Matched context(s) (Array key defines match quality):
Array
[1] => rpaas
## Request will go to context: rpaas
## Modified request URL:

Did you clear all core/cache dir contenta manually?

Sometimes persistent cache tricks us… I faced that issue.
Your setup seems correct and I am assuming resource Id 443 exists.

Cheers

Yeah, cache seems to be the cause of a lot of my issues, just when you think you have it.

But yeah I have cleared cache, even reinstalled the plugin and tried ContextRouter. Surprisingly enough ContextRouter caused all my other subdomains not to work.

If that seems correct I will keep looking into it, maybe my domain is wrong, then again, I have issued an SSL cert for them and it recognized them as pointed to the right direction.

Do I need to adjust my NGINX rewrite rules in order to use an additional URL?

With xrouting you shouldn’t.

In your cloud dashboard: did you add the domain to the cloud account under the Domains tab? And since you’re using ssl, did you reissue the cert so that it covers the new domain (under Add-ons > SSL)?

Hey, thanks for replying. Yeah all the domains resolve as they should. Even ran a test page in the home directory and used the secondary domain to access it with no issues. and ALL certs work as they should.

What do you have in your nginx rules? Might be something like the redirect to https that is specific to the original domain that needs to be rewritten to include the new domain?

There is mainly an HTTPS rewrite and rewrite for canonical using only the www version mainly. Everything else is caching of images.

I have tried removing all the rules too. It will end up being something very small I just know it.

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; 
if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;
}

if ($host = "onesourcevirtual.us") {
    return 301 $scheme://www.onesourcevirtual.us$request_uri;
}

When I try to load that url (https://www.osvrpaas.com/) I get a 403 Forbidden page. I say this only because you said you are seeing a 404 page…
Is the start page for the new context published?

This is a testing environment, I have it blocked to only my internal IP.

edit: I took the restriction off, but the site status is still offline.

Makes sense.

Anything in the page template? … Hard-coded base URL for some other domain? (Now I’m just grasping.)

Edit: Also have you submitted a ticket to MODX Cloud support? Even though it doesn’t seem like a cloud issue per se, they are just so smart and helpful.

Thank’s for trying, That’s a good suggestion. I tried using the --base href="[[!++site_url]]"-- and also made it just on a blank template.

I’m going to try and rebuild it all from scratch and see if something clicks.

I feel silly, It is the site status being down…Turned it on and all works.

1 Like

Aaaa! You did say that, and I read it and assumed you meant the start page wasn’t published. Wish I’d been paying better attention. But YAY - it’s fixed now!