We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54308
    • 9 Posts
    I am running Modx 2.6.5-pl on a Windows 2016 server.

    I am trying to get a 2nd context running but when I call its url it loads up the start page defined in the default Web Context. I have Gateway Manager installed with http_host, site_start and site_url settings configured for both the web and my new context. In addition, I added a default_template in my context settings.

    I have defined a new template to use on my new context along with new chunks and assigned them to the new pages in the new context. When I create new pages in the new context the new template is being assigned.

    When I select view from the home page in the new context the content from the "Web" context displays with the URL assigned to the new context. When I select view on another page that I created in the new context I get a 404 error.

    I also tried using ContextRouter and XRouting. ContextRouter gives me some errors when it tries to install. Neither made any difference. Currently they are uninstalled.

    In chrome developer tools I am seeing this error:
    Access to Font at 'http://myoriginaldomain.com/domain1/assets/fonts/my-font.ttf?cwmxip' from origin 'http://my2nddomain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://my2nddomain.com' is therefore not allowed access.

    My modx install is set up with a shared html folder for all contexts but I have added a media set for each context to store that sites files. html/assets will be used for shared files.

    Anyone have any ideas on how to fix this?

      • 17301
      • 932 Posts
      You could try setting this in your htaccess but I never had any luck with gateway manager personally when i tried it years back and have always used xrouting without issue.

      <IfModule mod_headers.c>
          Header set Access-Control-Allow-Origin "*"
      </IfModule>

        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 54308
        • 9 Posts
        There isn't an htaccess file with IIS. There is an url rewrite module that updates the web.config (or you can enter directly into web.config) that generally does the similar things that I've seen done with htaccess.

        My problem is not that I need to give Access-Control-Allow-Origin rights to my content. I showed the error because you can see my2nddomain is trying to access content in myoriginaldomain. I don't want or need it to. It knows that it is in a different context from myoriginaldomain but it is trying to run the start_page defined for myoriginaldomain anyway.

        My problem is it won't run the start page defined for my new context. Site_start in settings is now 0 but originally was 1. site_start for the original context (web) = 1. site_start for my new context = 68. It keeps running 1. I even tried setting my original context (web) to have a site_start of 68. When I did that, I got a 404 error on my original site - so it won't run resource 68. It is published.

        I also tried xRouting again but still no go.
          • 54308
          • 9 Posts
          Still not working. I removed Gateway Manager and am just using xRouting.
          Context settings:
          base_url: /
          default_template: 22
          http_host: test.mydomain.com
          site_start: 68
          site_url: http://test.mydomain.com/

          Internal DNS points to the IP for my modx site in IIS.

          I have created a home (with a resource Alias of index) and an about-us page in my new context. Both are published. When I use the view option on either page my 404 page comes up from my Web context (which is the error page in system settings).

          Access Permissions on the new context include (anonymous) with Load Only (authority 9999) and Administrator with Context (Authority 0).

          My template is bare minimum
          <!DOCTYPE html>
          <html lang="en">
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          </head>
          <body>
          [[*content]]
          </body>
          </html>

          Home page content is minimal. I'm just trying to get the page to come up right now.
          <p>home page</p>

          Pages in my default context work fine. I've tried disabling all URL Rewrite rules. Didn't make any difference although

          Why won't the pages in my new context come up?
            • 17301
            • 932 Posts
            Is your subdomain pointing to the same document root as the primary domain (not just ip)?
              ■ email: [email protected] | ■ website: https://alienbuild.uk

              The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
              • 54308
              • 9 Posts
              Yes. It's not a subdomain of the other domain. They are completely different domains. The "test" is just temporary until we go live and will be changed to "wwww".

              It appears to be working now. I cleared the cache (again).

              ???
                • 17301
                • 932 Posts
                Glad its working now smiley
                Could have been ISP cache or a number of other things.
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.