Setup Sentry on another SSL port than 443 with docker


Hi everyone !

I’m actually struggling with Sentry configuration. I want to make it run with HTTPS, so, I used nginx as reverse-proxy.

It works very well until I try to make it run on another port than the default 443.

Here important parts of my configuration files:


    image: nginx:alpine
      - "49080:80"
      - "49443:443"
      - web


  server {
    listen   80;

    location / {
      if ($request_method = GET) {
        rewrite  ^ https://$host:49443$request_uri? permanent;
      return 405;

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;


  ssl_certificate ...
  ssl_certificate_key ...

  access_log /var/log/nginx/sentry_project.log;
  charset utf-8;

  location / {
    include proxy.conf;
    proxy_cache_bypass $http_upgrade;
    proxy_pass  http://web:9000;

So, with this configuration, when I run my docker-compose, I see that my nginx redirection work well, my request is redirected into the web service. Giving me this log:

web_1        | XXX.XX.X.10 - - [05/Apr/2018:17:01:00 +0000] "GET / HTTP/1.1" 302 487 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

But then, I’m redirected to the But without the port 49443 specification.

I’ve tried to setup the system.url-prefix: '' but it didn’t resolve the issue.

Also, if I map my nginx service ports with "443:443" I have no trouble. So, I suppose my problem must be an environment variable to overwrite.

Thank you, for reading me :slight_smile: