CloudFront Dynamic Content & Apache using Multiple Virtual Hosts

5,690

Solution 1

this problem is now solved by Amazon.

Check this link: https://forums.aws.amazon.com/message.jspa?messageID=552969#552969

And this link: http://aws.amazon.com/blogs/aws/enhanced-cloudfront-customization/

Solution 2

Cloudfront currently doesn't have the ability to pass the Host header back to the origin. Instead it passes the host specified in the Cloudfront distribution's origin field. So while viewing a page through ELB will properly pass the host name you provide in your browser back to your web instance (thus bringing up the correct virtual host), the same request made through Cloudfront through to ELB and on to your web instance will arrive at the web instance with the host name of the ELB. I know, frustrating.

They know about it (as of writing this); hopefully it's fixed soon:

https://forums.aws.amazon.com/thread.jspa?threadID=84588

Share:
5,690

Related videos on Youtube

Adam
Author by

Adam

Updated on September 18, 2022

Comments

  • Adam
    Adam over 1 year

    I've tried to setup CloudFront to point to an Elastic Load Balancer.

    I can see the requests are reaching the web server (which as multiple Virtual hosts configured) however the requests always end up at the /var/www/error/noindex.html page.

    If I remove CloudFront from the www DNS the sites work fine on apache though the ELB.

    Also I have the CName www for each domain setup.

    Any thoughts on why these CloudFront requests would arrive at the error page?

    thx

  • Snowlockk
    Snowlockk over 9 years
    "While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes"
  • user3742266
    user3742266 over 9 years
    Ok, sorry. You need to create a whitelist with the headers you want to bypass in the Behaviours tab inside Distribution Settings.
  • iMil
    iMil almost 8 years
    The answer might be shorter than it should, nevertheless, @user3742266 is correct while the most upvoted answer is wrong :(