# Http2, Websockets and SSOwat (Cockpit)

**URL:** https://forum.yunohost.org/t/http2-websockets-and-ssowat-cockpit/11116
**Category:** Discuss
**Tags:** nginx, english
**Created:** [April 27, 2020, 12:48pm UTC](https://forum.yunohost.org/t/http2-websockets-and-ssowat-cockpit/11116 "2020-04-27T12:48:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Salamandar](https://forum.yunohost.org/user_avatar/forum.yunohost.org/salamandar/32/440_2.png) [@Salamandar](https://forum.yunohost.org/u/Salamandar)
#### Post date: [April 27, 2020, 12:48pm UTC](https://forum.yunohost.org/t/http2-websockets-and-ssowat-cockpit/11116/1 "2020-04-27T12:48:50Z")

</div>

Hi there,  
I’m trying to make Cockpit ([cockpit-project.org](http://cockpit-project.org)) work, with plans to propose this as a Ynh app.  
Currently, I’m not able to make websockets work through Nginx.

My nginx config file is :

```
rewrite ^/cockpit$ /cockpit/ permanent;

location /cockpit/ {
    proxy_pass https://127.0.0.1:9090/cockpit/;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    # Required for web sockets to function
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_set_header Upgrade websocket;
    proxy_set_header Connection "Upgrade";

    # Pass ETag header from Cockpit to clients.
    # See: https://github.com/cockpit-project/cockpit/issues/5239
    gzip off;

    # Include SSOWAT user panel.
    # include conf.d/yunohost_panel.conf.inc;
}

```

My request url : `wss://mydomain.fr/cockpit/cockpit/socket`

Any clue ?

---

<div class="post-metadata">

### Author: ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)
#### Post date: [April 27, 2020, 12:50pm UTC](https://forum.yunohost.org/t/http2-websockets-and-ssowat-cockpit/11116/2 "2020-04-27T12:50:40Z")

</div>

Have you look into the browser console ?

Also there’s an existing package though no idea in what state it is … [https://github.com/YunoHost-Apps/cockpit\_ynh/blob/master/conf/nginx.conf](https://github.com/YunoHost-Apps/cockpit_ynh/blob/master/conf/nginx.conf)

---

<div class="post-metadata">

### Author: ![Salamandar](https://forum.yunohost.org/user_avatar/forum.yunohost.org/salamandar/32/440_2.png) [@Salamandar](https://forum.yunohost.org/u/Salamandar)
#### Post date: [April 27, 2020, 1:12pm UTC](https://forum.yunohost.org/t/http2-websockets-and-ssowat-cockpit/11116/3 "2020-04-27T13:12:15Z")

</div>

Thanks for pointing out the (non-working) existing app. I should’ve read in more details the nginx conf. Looks like I was just missing one line :

```
proxy_set_header Origin http://$host;

```

Now it’s working !  
I may do a PR to the existing app soon or later this week.
