Search code examples
ruby-on-railsamazon-web-serviceshttpslocalhostaws-certificate-manager

Enable HTTPS For AWS With Locally Running Rails Application


I have a Rails application that I need to move over to HTTPS. It currently pulls assets from S3 via Cloudfront. I need to be able to test the application locally as well as on staging.

I have successfully set up HTTPS for my local application (running on localhost:3000), but obviously the assets are failing to load because they are insecure. So I need to secure Cloudfront and the S3 bucket.

However, given that my application is running on localhost, I can't add that as a domain when setting up a certificate using AWS Certificate Manager. So how can I set things up so that my local application is able to access S3 assets over HTTPS? Do I need to expose my local application via a tunnel? If so, what are the implications regarding HTTPS?


Solution

  • The domains shouldn't need to match for this to work. You just need to be using HTTPS for all the resources that are loaded by the browser. Just add an ACM certificate to the CloudFront distribution for the domain you will use when the app is running on AWS.