Nginx代理cool.html时报502,但访问hosting/discovery是可以的

nginx代理cool.html时报502,但访问hosting/discovery是可以的,什么原因

hii @zzyo

If /hosting/discovery works but /cool.html gives 502, it means your basic HTTP proxy works, but WebSocket (or long connection) traffic isn’t passing correctly through Nginx.
cool.html needs WebSocket (/cool/…/ws) to talk to Collabora, while /hosting/discovery is just a simple HTTP request — that’s why discovery works but the editor page fails.

enable WebSocket proxying

In your Nginx config, make sure you have something like this:

location ^~ /cool/ {
    proxy_pass https://127.0.0.1:9980;
    proxy_set_header Host $host;

    # Required for WebSocket support
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_read_timeout 36000s;
    proxy_ssl_verify off;
}

Replace https://127.0.0.1:9980 with http://127.0.0.1:9980 if your Collabora instance isn’t using SSL internally.


Extra checks

  1. Collabora URL — make sure the internal port (e.g. 9980) is reachable from Nginx.
  2. Self-signed certificate? — if you’re using one, proxy_ssl_verify off; is needed.
  3. Trailing slash consistency — ensure you access /cool/ not /cool in the proxy path.

I also see many past thread in forum with same issue so i would suggest to explore using search ? Bad Gateway 502 with Nginx on native Install - Debian

我加上了 也不行,貌似就静态资源有问题,里面的接口都是能调用的