docker-magento2-nginx icon indicating copy to clipboard operation
docker-magento2-nginx copied to clipboard

Support for https nginx rev proxy

Open kusmierz opened this issue 8 years ago • 1 comments

Support for https proxy, like (client browser) -> (nginx revproxy on port :80 or :443) -> (docker backend on 127.0.0.1:8080), sample config:

upstream teststream {
  server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name .teststream.dev;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;

    server_name .teststream.dev;

    root /dev/null;

    location / {
        # serve static files from defined root folder;.
        # @teststream is a named location for the upstream fallback, see below
        try_files $uri $uri/index.html $uri.html @teststream;
    }

    location @teststream {
        expires off;

        proxy_read_timeout 300;
        proxy_connect_timeout 300;
        #proxy_redirect     off;
        proxy_redirect     http:// $scheme://;

        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-Forwarded-Port  $server_port;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;

        proxy_pass http://teststream;
    }
}

kusmierz avatar Jul 18 '16 21:07 kusmierz

Sorry I haven't seen this for so long -- never got a notification on this one.

Two things:

  • Does this break for setups that don't use https?
  • Can you update the README with a sample usage/example?

markshust avatar Mar 31 '17 11:03 markshust