Unable to set up BOSH (conf nginx ?)

My YunoHost server

YunoHost version: 4.0.8

Description of my issue

I’m trying to set up a JSXC (messaging inside Nextcloud), for that I to configure a BOSH access to Metronome.
I append inside the main domain nginx configuration file :

server {
       listen 80;
       ...
        location = /http-bind {
           proxy_pass http://localhost:5290/http-bind;
    #       proxy_set_header Host $host;
    #       proxy_set_header X-Forwarded-For $remote_addr;
    #       proxy_buffering off;
    #       tcp_nodelay on;
           proxy_redirect    off;
           proxy_set_header  Host $host;
           proxy_set_header  X-Real-IP $remote_addr;
           proxy_set_header  X-Forwarded-Proto $scheme;
           proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header  X-Forwarded-Host $server_name;
           proxy_set_header  X-Forwarded-Port $server_port;
        }

The BOSH module seems to work, as on the server :

    curl -i localhost:5290/http-bind
    (...)
    <!DOCTYPE html><html><head><title>Metronome's BOSH Interface</title></head><body>
    		<p>It works! Now point your BOSH client to this URL to connect to the XMPP Server.</p>

But testing the nginx redirection, it got catched by the SSO :

curl -i http://domain.tld/http-bind
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Sun, 18 Oct 2020 16:25:35 GMT
Content-Type: text/html
Content-Length: 154
Connection: keep-alive
X-SSO-WAT: You've just been SSOed
(...)
<head><title>302 Found</title></head>

How could I bypass the SSO ?

You should not tweak/hack into the server conf of Nginx, that would break it anytime YNH wants to manage it.
Why not use a Redirect app for that?

yunohost app install redirect -a "domain=your.domain&path=/http-bind&redirect_path=http://localhost:5290/http-bind&redirect_type=public_proxy" -l BOSH

Afterwards, if it does not work, try editing the conf file to have location = /http-bind. The file should be /etc/nginx/conf.d/your.domain.d/redirect.conf (or redirect__2, etc. depending on how many redirect apps you have)

Many thanks, this works directly !

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.