Search code examples
nginxdockerdocker-composeparse-server

Nginx not redirect to https docker ports


Im using Docker compose with mongoDB,Parse server and Parse Dashboard, with different ports. My Nginx its working good except when I enter the server ip with the ports of the docker images.

 - www.mydomain.com -> https
 - 1.21.221.21 (my ip) -> https
 - 1.21.221.21:4040 -> http

Here is my nginx conf:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name mydomain.com www.mydomain.com;
    return 301 https://$server_name$request_uri;
}

Any idea? Im getting crazy on sunday


Solution

  • When you request 1.21.221.21:80 you have access to nginx, and it redirect you to https.

    But when you have request 1.21.221.21:4040 (app port) your request goes directly to app. Nginx does`t handle this request.