0
votes

I am facing difficulty in serving requests from test.domain.com with the configuration with a combination of AWS Certificate Manager (ACM), AWS EC2 (linux AMI), AWS CloudFront (CF), Google DNS and Apache server.

I have following setup in public_html directory:

I have 2 folders in /var/www/html

  • prod
  • test

Objective is to serve requests received from test.domain.com using test directory and the ones received from domain.com using prod directory.

The setup is working fine with acme ssl certificates ie., for production (domain.com), we are using acme SSL certificate and DNS is pointing to Elastic IP and working fine. Even test.domain.com was working fine with acme ssl setup.

However, I'm trying to switch to ACM. As it works only with CF and ELB (AWS Elastic Load Balancer), created a CF distribution.

  • Created one CloudFront (CF) distribution pointing to AWS EC2 endpoint with Origin path /test.
  • Redirected test.domain.com to CF distribution in Google DNS as the domain is registered with them.

With this setup, test.domain.com is also presenting domain.com and not the test server as anticipated.

https.conf has correct DocumentRoot for each ServerName. But, request is not hitting the virtualhost of test server..

whats missing? pls suggest..

1

1 Answers

0
votes

You can try below:

  1. Add both domain.com and test.domain.com to CloudFront CNAME list.
  2. ACM certificate which has common name/SAN as domain.com and *.domain.com (or test.domain.com)
  3. In CloudFront cache behavior , whiteist HOST header, this will make sure that when client access domain.com , cloudfront send the same value in host header when contacting origin.

Link: Forward host header