Why is Modx Cloud turning my links to the cloud address whenever I preview a page?

108 views Asked by At

I have a site which runs on Modx cloud and every time I preview a page (like WordPres preview button), the modx cloud server address is linking me to the test page, instead of the "preferred .url". For example 123modxcloud.com/test-page.html instead of preferred.com/test-page.html. Now whenever that happens, my whole site's url turns into the modx cloud server address. The main menu links, when that happens, the font icons that I used turns unreadable. Firebug says:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.preferred.com/web_assets/inc/icons/iconmoonfonts/fonts/icomoon.woff. This can be fixed by moving the resource to the same domain or enabling CORS.

When I sent a report to the Modx support team, they said I can clear the cache. It works but that fix is not really a cure because when I preiview a site again, it happens again. Now I always need to clear the cache because if I don't, the website will only show squares for the font icons that I use. Not to mention the url turns to the modx cloud address which is very long and not the "pretty domain name" that I set it to.

1

There are 1 answers

0
Mazuhl On

Lots of MODx sites and templates set a base URL tag. If yours is set to your preferred URL (rather than just reflecting the site/domain you're currently viewing the site on) that could be causing a problem.

<base href="[[++site_url]]" />

Set this to be uncached and you shouldn't have any problem with the URLs and CORS since everything will be served up from the same domain:

<base href="[[!++site_url]]" />