0

I've been struggling and googling this issue for a while and although it seems to me like a pretty standard requirement I couldn't find a working solution anywhere.

I don't want to disable HTTP, only redirect it to HTTPS. Not between the load balancer and the EC2 instances, but between the browser and the load balancer.

I have created an Elastic Beanstalk environment (Linux) for my Spring Boot app, configured the load balancer for HTTP + HTTPS using the management console and configured environment variables and IP tables using .config files in an .ebextensions folder zipped with the app's JAR file.

Then I tried adding an NGINX configuration for a permanent HTTP to HTTPS redirect using a config file with a "files" key, but it doesn't seem to have any effect.

Thanks

Isabel Inc
  • 1,871
  • 2
  • 21
  • 28
kermit
  • 1

1 Answers1

0

This is my NGINX configuration to redirect to https:

# HTTP - redirect all requests to HTTPS
server {
    listen 80;
    listen [::]:80 default_server ipv6only=on;
    return 301 https://$host$request_uri;
}

Give it a try if not please paste your NGINX configuration file

Nick
  • 1,032
  • 16
  • 27
  • This is identical to my configuration. But instead of configuring NGINX on each and every EC2 instance what I'm trying to do is to add a configuration file to my .ebextensions folder and apply this configuration automatically using a "files" option. Some like (not sure what SOME_PATH should be): `files: "/000_http_to_https.conf": mode: "000755" owner: root owner: root content: | listen 80; listen [::]:80 default_server ipv6only=on; return 301 https://$host$request_uri;` – kermit Jul 23 '16 at 16:17