0

Current Scenario

I am hosting a wordpress website on a ECS instance which runs wordpress in a docker container

My wordpress is working fine but i want to change HTTP to HTTPS

What i dont want to use

1) ELB

2) Anything cost ineffective

What i tried

I tried using cloud front and setting ec2-52-64-xxx-xxx.ap-southeast-2.compute.amazonaws.com as origin domain and origin id

I also set it to redirect HTTP to HTTPS

Current CloudFront behaviour

What happens is when i goto the cloudfront link it redirects me to ec2-52-64-xxx-xxx.ap-southeast-2.compute.amazonaws.com (HTTP) instead of using the cloudfront link

Desired CloudFront behaviour

It should use the HTTPS cloudfront URL to use my wordpress website by redirecting any traffic from my origin from HTTP to HTTPS

Current Server configs

1) I don't have any SSL/TLS certificate installed in my ECS instance

2) My .htaccess file has default values (not sure if i even should update it or cloudfront will work without any changes to .htaccess)

3) Wordpress is not installed so the database does not have any values which might be causing a redirect ( I deleted the database to test if that might be causing the inconsistency)

I am really new to AWS,There might be a better way to achieve HTTP to HTTPS redirect i think any sugggestions/help is highly appreciated thanks :)

Ali Khan
  • 114
  • 2
  • 4
  • 21
  • 1
    From [AWS Cloudfront redirecting to S3 bucket](https://stackoverflow.com/a/45047048/174777): _S3 updates the DNS for the global REST endpoint hierarchy *.s3.amazonaws.com with a record sending requests to the right region for the bucket within a short time after bucket creation, and CloudFront appears rely on this for sending the requests to the right place. Before that initial update is complete, S3 will return a redirect and CloudFront returns that redirect to the browser._ Therefore, just wait a while (a few hours?) and it will start working as you expect. – John Rotenstein Feb 11 '20 at 04:19
  • S3 ? but my origin is an ec2 instance Public DNS ... also will i have to update the `.htaccess` file to allow URL rewrites ? ( Also i waited the entire night around 6 hours) did not work out for me :(( – Ali Khan Feb 11 '20 at 04:34
  • Oops, my bad! If you have waited 6 hours, things should have updated. This sounds like a case for contacting AWS Support. (Yes, you'll need to subscribe, but the assistance you can get from AWS Support will save you a lot of time figuring this out.) – John Rotenstein Feb 11 '20 at 04:43

0 Answers0