Using Multi-Site capabilities in Craft CMS v3.9 where HTTP_HOST
isn't accurate
#14544
Unanswered
GaryReckard
asked this question in
Q&A
Replies: 1 comment
-
I can't think of (or find) anywhere in Yii or Craft where we write to either HTTP_HOST or SERVER_NAME. We read from those values, sure. https://github.com/yiisoft/yii2/blob/master/framework/web/Request.php#L754-L777 I’ve never used Silverline WAF or Azure Front Door, but as a starting point, I’d focus on those to see if they are injecting values into those headers that Craft/Yii is just reading from. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a site that is behind a Silverline WAF and Azure Front Door, it runs in a docker container, and for reasons I don't 100% understand, the actual hostname isn't getting passed through to Craft. If I output
$_SERVER['HTTP_HOST']
it is just showing the IP address. (Same for$_SERVER['SERVER_NAME']
)I believe we've got things working for the single site by setting
$_SERVER['HTTP_HOST']
based on an.env
variable in the production environment. But now we're adding three new sites. The new sites are using unique subdirectories, such as /en-fr/ and /fr-fr/, and this is working great locally and on staging. But on production, visiting those subdirectories throws a 404.I've tried a few things after some googling, but none of it has resolved the issue. I've tried setting the
siteUrl
value for each site manually in thegeneral.php
config:Also, I originally had the new sites configured with a baseUrl like
baseUrl: '@web/fr-fr/'
. (The primary site usesbaseUrl: 'https://$SITE_URL'
). That wasn't working, so I tried changing that to something likebaseUrl: '@web_frFr/'
and setting up these aliases in
general.php
:but no luck there.
These attempts probably expose my lack of understanding + confusion about how all this really works...
Wondering if anyone has any suggestions on how to get this multi-site stuff to work in my type of setup. Sidenote: we do have plans to upgrade to Craft v4, but that's still maybe months away. We need to get these new regional sites up ASAP.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions