在 Caddy 下切换 Atlassian Confluence 而不是 NGINX

Switching Atlassian Confluence under Caddy instead of NGINX

所以我最近开始遇到 NGINX 崩溃的问题,原因不明。

在花了很多时间尝试修复它之后,我决定改用 Caddy。

我的 caddy 配置适用于浏览网站,但它破坏了编辑页面时使用的 /synchrony 访问权限。 pure websocket 部分有效,我使用 http://websocket.org/echo.html 进行了测试,但 Confluence 也通过该路径检索了一些脚本。

我使用以下内容作为故障排除参考:https://confluence.atlassian.com/conf60/troubleshooting-collaborative-editing-852732552.html

我的工作 NGINX 配置

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";
    }
}

我建议的等效非工作 Caddy 配置

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
  }
}

以上内容基于以下文档:https://caddyserver.com/docs/proxy 它使用 transparentwebsocket 预设。

主要错误似乎是阻止了编辑页面

我认为您可能需要使用 without 参数。

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.

你可以试试这个:

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      
  }
}