# Unable to set up BOSH (conf nginx ?)

**URL:** https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995
**Category:** Support
**Tags:** english
**Created:** [October 18, 2020, 4:28pm UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995 "2020-10-18T16:28:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anubis](https://forum.yunohost.org/user_avatar/forum.yunohost.org/anubis/32/9218_2.png) [@anubis](https://forum.yunohost.org/u/anubis)
#### Post date: [October 18, 2020, 4:28pm UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995/1 "2020-10-18T16:28:30Z")

</div>

### 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 :

```auto
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 :

```auto
    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 :

```auto
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 ?

---

<div class="post-metadata">

### Author: ![tituspijean](https://forum.yunohost.org/user_avatar/forum.yunohost.org/tituspijean/32/3584_2.png) [@tituspijean](https://forum.yunohost.org/u/tituspijean)
#### Post date: [October 20, 2020, 8:47pm UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995/2 "2020-10-20T20:47:58Z")

</div>

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?

```auto
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)

---

<div class="post-metadata">

### Author: ![anubis](https://forum.yunohost.org/user_avatar/forum.yunohost.org/anubis/32/9218_2.png) [@anubis](https://forum.yunohost.org/u/anubis)
#### Post date: [October 20, 2020, 9:02pm UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995/3 "2020-10-20T21:02:21Z")

</div>

Many thanks, this works directly !

---

<div class="post-metadata">

### Author: ![system](https://forum.yunohost.org/uploads/default/original/2X/f/f59fe8e3ee6b100b4f574d30d6e30479c68b89f0.png) [@system](https://forum.yunohost.org/u/system)
#### Post date: [November 4, 2020, 9:02pm UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995/4 "2020-11-04T21:02:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pitchum](https://forum.yunohost.org/user_avatar/forum.yunohost.org/pitchum/32/1153_2.png) [@pitchum](https://forum.yunohost.org/u/pitchum)
#### Post date: [July 17, 2025, 7:35am UTC](https://forum.yunohost.org/t/unable-to-set-up-bosh-conf-nginx/12995/5 "2025-07-17T07:35:23Z")

</div>

Sorry to bump an old topic, but I just wanted to mention that Bosh and Websocket are now properly managed by prosody app since commit [c0c0499](https://github.com/YunoHost-Apps/prosody_ynh/commit/c0c04998aae64b58738840050870f1200b2b2e66) (currently only available in the testing branch, testers are welcome 🙂 ) without the need for manual tweaking nor redirect app.

- Bosh is then available on [https://yourmaindomain.tld/xmpp-bosh/](https://yourmaindomain.tld/xmpp-bosh/)
- Websocket is then available on [https://yourmaindomain.tld/xmpp-websocket/](https://yourmaindomain.tld/xmpp-websocket/)

Also note that this change made it possible to implement [XEP-0156](https://xmpp.org/extensions/xep-0156.html) “Discovering Alternative XMPP Connection Methods”.  
This allows some XMPP clients to automatically use the websocket on HTTPS when the standard XMPP TCP ports are not reachable (when using a restrained public Wifi connection for example).
