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

asked 2 years ago582 views
2 Answers
2
Accepted Answer

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
answered 2 years ago
  • 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
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions