1

So I recently started getting issues with NGINX crashing for unknown reasons.

After passing to much time on trying to fix it I decided to move to Caddy instead.

My caddy configuration works for navigating the website, but it breaks the /synchrony access, used when editing the pages. The pure websocket part works, I tested using http://websocket.org/echo.html, but Confluence also retrieves some scripts through that path.

I used the following as reference for troobleshooting: https://confluence.atlassian.com/conf60/troubleshooting-collaborative-editing-852732552.html

My working NGINX configuration

server {
    listen 443 ssl;

    server_name [REDACTED];

    ssl_certificate [REDACTED];
    ssl_certificate_key [REDACTED];

    client_max_body_size 100m;

    location / {
        proxy_pass http://localhost:8090;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
    location /synchrony {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8091/synchrony;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}

My suggested equivalent non-working Caddy configuration

https://[REDACTED] {
  log access.log
  errors error.log
  gzip
  tls "C:\caddy\[REDACTED].cer" "C:\caddy\[REDACTED].key"

  proxy /synchrony http://localhost:8091/synchrony {
    websocket
  }

  proxy / http://localhost:8090 {
    except /synchrony
    transparent
  }
}

The above is based on the following documentation: https://caddyserver.com/docs/proxy It uses the transparent & websocket presets.

The main error that seems to be blocking the edit page Chrome Developer Tools Network screenshot of failing request

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Joel Bourbonnais
  • 2,618
  • 3
  • 27
  • 44

1 Answers1

1

I think you may need to use the without parameter.

without is a URL prefix to trim before proxying the request upstream. A request to /api/foo without /api, for example, will result in a proxy request to /foo.

You may try this:

https://[REDACTED] {
  log access.log
  errors error.log
  gzip
  tls "C:\caddy\[REDACTED].cer" "C:\caddy\[REDACTED].key"

  proxy /synchrony http://localhost:8091/synchrony {
    websocket
    without /synchrony
  }

  proxy / http://localhost:8090 {
    except /synchrony
    transparent      
  }
}
Sagar
  • 9,456
  • 6
  • 54
  • 96
Toby Allen
  • 10,997
  • 11
  • 73
  • 124