How to enforce HTTPS in my AWS APP RUNNER service even visitors enter HTTP?

642 Views Asked by At

I have successfully launched AWS APP RUNNER for a NEXT.JS service, and associated with a CUSTOM domain example.com, everything work very fine with https://example.com, however when visitor enter http://example.com, it's does not work, what can I do with the AWS APP RUNNER? Many thanks!

Expected http will route to https automatically

2

There are 2 best solutions below

0
On

A redirect from HTTP to HTTPS is currently not supported out of the box by AWS AppRunner. See https://github.com/aws/apprunner-roadmap/issues/37 for details. It looks like the dev team is working on it - fingers crossed.

One workaround for now might be to use an AWS CloudFront distribution with a viewer protocol policy to redirect http to https (as described in https://github.com/aws/apprunner-roadmap/issues/37#issuecomment-906893256).

Update 2023-02-23:

HTTP to HTTPS redirection is now supported on AppRunner. See https://aws.amazon.com/about-aws/whats-new/2023/02/aws-app-runner-http-https-redirect/

0
On

Amazon recently announced HTTP to HTTPS redirect. You can checkout below link.

HTTP to HTTPS redirect