ALB with Cloudfront

0

Hi everyone,

I set up Cloudfront - ALB - web server (Dotnet Nuke DNN CMS) Cloudfront got the domain of the front end, the ALB a domain for the communication between cloudfront and ALB, behind the ALB is the web server. The problem is now, the index page works fine, no errors. But the website now contains hyperlinks of the "internal" domain of the ALB that I use for the communication between ALB and Cloudfront. What we need is of course hyperlinks of the public domain facing to the client. Is it possible to tell the server from the ALB or Cloudfront that the domain is not the internal but the public domain? Maybe we have to set this on the webserver, but unfortunately I'm not a DNN developer, so I don't know what to tell the developer what to do.

Thank you and best

질문됨 2년 전595회 조회
2개 답변
2
수락된 답변

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.

Ritchie
답변함 2년 전
  • Exactly what I was looking for, I needed to disable all caching features. Now the website looks good behind Cloudfront. Awesome, thanks a lot!

0

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.

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠