Question

I've been googling this all afternoon, suffering from Search Engine blindness, so much so I even tried bing for a moment...

I have a multiple language site set up with different URL's assigned to different store views, here's an example :

All Store View : primary.domain.tld
--> Store One : [en] one.domain.tld
   --> View One : [en] one.domain.tld (inherit from default)
   --> View Two : [fr] two.domain.tld 
--> Another Store : [de] another.domain.tld

This is the clients requirement not mine so refactoring domains or creating new ones for websites/stores is out I'm afraid.

Now the site works fine but when I view two.domain.tld all the CSS and JS is requested from one.domain.tld. It all works but the fonts that get called trigger alot of CORS messages and some of the JS complains about cross origin.

The stricter developer in me also considers if i end up overriding a CSS or JS file for some reason for that specific store view that will bawk too.

Ideally I'd like the CSS, JS and all requests to be coming from two.domain.tld (the assets being requested are in the correct pub/static folder too).

For the two.domain.tld Store configuration all the Base URL's parameters in "web" section, for both Secure and Unsecure are overriden and set tot he correct domain (Base URL, Base Link URL, Base URL for Static View Files & Base URL for User Media Files).

Anyone got any ideas? Obvs all these CSS and JS files are referenced in the theme layout (or module layout), as said above they are deployed to the correct pub/static folders but the

Was it helpful?

Solution

For anyone wondering, we actually ended up setting up Cross Domain Allow policies for the alternative store views so they can pull resources from the default store view.

It's not as graceful as I'd have liked (really M2 should be using the correct URL from the store view config) but it works so there's an alternative if (like us) you're stuck on an older M2 core (not sure if this works as intended in latest M2 version).

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top