Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

I want to redirect all the HTTP request to https request on elb. I have 2 ec2 instances. I am using nginx for the server. I have tried a rewriting the nginx conf files without any success. I would love some advice on it.

1 Answer

0 votes
by (44.3k points)

You can use ELB’s X-Forwarded-Proto header to detect if the original request was redirected from HTTP to HTTPS.

You can type this in your server configuration

if ($http_x_forwarded_proto = 'http') {

    return 301$request_uri;


For more information, take a look at the official documentation.


Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94k users

Browse Categories