Possible nginx reverse-proxy issue: Bad URI syntax| wsd/ClientRequestDispatcher.cpp

Hi @darshan

Thank you so much once again!

By removing the --o:net.service_root=/collabora from coolwsd we will end in one of my very first tests, where the “urlsrc” links (shown at /hosting/discovery) would stay with its default state:

https://mydomain.com/browser/d5ebff5/cool.html?

which means we would not be able access to any of its content. It was base on this that I was lead to introduce the --o:net.service_root=/collabora change so the “urlsrc” links from /hosting/discovery could be accessible:

https://mydomain.com/collabora/browser/d5ebff5/cool.html?

Considering then this scenario again:
my docker compose.yml

services:
  collabora-app:
    image: collabora/code
    container_name: collabora-app
    ports:
      - "127.0.0.1:8085:9980"
    environment:
      - domain=mydomain.eknow.com
      - extra_params=--o:ssl.enable=false --o:hostname=mydomain.eknow.com --o:ssl.termination=true 
      - aliasgroup1=https://mydomain.com:443
    extra_hosts:
      - "mydomain.com:host-gateway"

Having my nginx with:

 location ^~ /collabora/browser {
   proxy_pass http://127.0.0.1:8085/browser;
   proxy_set_header Host $host;
 }

 location ^~ /collabora/hosting/discovery {
   proxy_pass http://127.0.0.1:8085/hosting/discovery;
   proxy_set_header Host $host;
 }

 location ^~ /collabora/hosting/capabilities {
   proxy_pass http://127.0.0.1:8085/hosting/capabilities;
   proxy_set_header Host $host;
 }


 location ~ ^/collabora/cool/(.*)/ws$ {
   rewrite ^/collabora/cool/(.*)/ws$ /$1/ws break;
   proxy_pass http://127.0.0.1:8085/cool/$1/ws;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }

 location ~ ^/collabora/(c|l)ool {
   proxy_pass http://127.0.0.1:8085/$1ool;
   proxy_set_header Host $host;
 }

 location ^~ /collabora/cool/adminws {
   proxy_pass http://127.0.0.1:8085/cool/adminws;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }

  location /collabora/ {
    proxy_pass http://127.0.0.1:8085/;
    proxy_set_header Host $host;
    proxy_buffering off;
  }

As soon as I try to make the call to collabora I get the following POST request log from Nginx, where it shows that it cannot find the https://mydomain.com/browser/d5ebff5/cool.html?:


xxx.xx.xxx.xxx - - [10/Oct/2024:11:52:46 -0400] "POST /browser/d5ebff5/cool.html?WOPISrc=https%3A%2F%2Fmydomain.com%2Fflask%2Fwopi%2Ffiles%2F123 HTTP/2.0" 404 281 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

Thank you once again!