- Le plus récent
- Le plus de votes
- La plupart des commentaires
Brettski@AWS is right about the relative links as far as rendering HTML is concerned. But even if you convert all of those to relative links, you may face other problems. If your CMS sends emails with links (e.g. email confirmations), sets webhooks or participates in OAUTH2 flows for SSO, it's going to have to create absolute links back to itself. That means that it will need to know its correct hostname.
There may be a setting in your CMS where you can specify this. But, if there isn't or you don't, it probably infers its hostname from the Host
HTTP header that the browser sends in its request. The problem is that where the browser is setting Host: www.your-site.com
, that is hitting Cloudfront which in turn queries the CMS. The query from Cloudfront will have something like Host: load-balancer.your-site.com
so that's what the CMS infers as its host name.
I haven't tried this myself yet but I think that this article describes the solution you need.
It sounds like the web server is producing "absolute" links to itself rather than "relative" links. This means that the raw HTML coming from the web server contains things like <a href="http://internaldomain.abc.com/folder/page.html">
rather than <a href="/folder/page.html">
.
The easiest thing to do (although it won't seem that way) is to change the web server to produce the relative links. You could also solve this by using some sort of proxy "in front" of the web server but that will introduce extra costs and additional layers that could fail.
Contenus pertinents
- demandé il y a un an
- demandé il y a 2 mois
- demandé il y a 9 jours
- Réponse acceptéedemandé il y a 7 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
Exactly what I was looking for, I needed to disable all caching features. Now the website looks good behind Cloudfront. Awesome, thanks a lot!