Open link in a new tab

Content

Expand project menu

Docker-Compose and Nginx for SSL and changed port leads to broken links

Hey there,

I am currently trying to setup an OpenProject instance to manage a software project at my university.

Requirements are: Use SSL and run on port 4791, also use docker
I realized this with using docker-compose to connect the OpenProject docker image with an nginx image, which is responsible for handling the SSL handshake and act as a reverse proxy.
Generally this setup seems to work fine and OpenProject is reachable at the correct port with SSL. However clicking some links causes my browser to redirect to the standard https port (443) (Due to “proxy_redirect http:// https://;” in the nginx.conf. Without that it redirects to port 80). For example, these links are broken; “Login” and “Logout”, as well as “Timelines”.

For reference, here are my docker-compose.yml and nginx.conf files:

docker-compose.yml:

version: "3"
services:
  openproject:
    image: openproject/community:latest
    volumes:
      - ./pgdata:/var/lib/postgresql/9.4/main
      - ./logs:/var/log/supervisor
      - ./static:/var/db/openproject
  web:
    image: nginx:alpine
    environment:
      SECRET_KEY_BASE: <somesecretkeybase>
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./ssl:/etc/nginx/ssl
    ports:
      - "4791:4791"
    depends_on:
      - openproject

nginx.conf:

events {

}

http {
    server {

        listen 4791 ssl;

        ssl_certificate /etc/nginx/ssl/ssl.crt;
        ssl_certificate_key /etc/nginx/ssl/ssl.key;
        ssl_session_cache shared:SSL:10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-EDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
        ssl_prefer_server_ciphers on;

        location / {

            proxy_pass http://openproject/;
            proxy_set_header Host $host;
            proxy_redirect http:// https://;
        }
    }
}

I hope you can help me fix the links.

- Florian