How to enable SSL with docker nginx reverse proxy for example.com:port

Viewed 25

I have a web application running on docker container and i want to publish it with somethig like https://example.com:3300

To run the application over HTTPS, and according to this answer i need to redirect to destination port

but i'm not sure how to publish domain with port attach to it

here's my nginx config so far

upstream application_upstream {
    server 0.0.0.0:3300;
    }


server {
    listen 443 ssl;

    server_name application_upstream;

    ssl_certificate /path/to/ssl.crt;
    ssl_certificate_key /path/to/ssl.key;

    return 301 $scheme://example.com:3300$request_uri;
}

server {
    listen 3300 ssl;

    server_name application_upstream;

    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;
    ssl_certificate /path/to/ssl.crt;
    ssl_certificate_key /path/to/ssl.key;

    location / {
        proxy_set_header Host $host;
        proxy_pass http://example.com:3300;
        proxy_redirect off;
   }
}

then page are returning ERR_SSL_PROTOCOL_ERROR

edit

the application running over http is no issue

0 Answers
Related