NGINX Proxy Pass with SSL Support #13

Closed
opened 2026-02-04 16:29:56 +03:00 by OVERLORD · 14 comments
Owner

Originally created by @gamelaster on GitHub (Aug 13, 2020).

This is my nginx proxy pass configuration for planka (with SSL).

server {
    server_name planka.url;

    listen 443 ssl;                                                         
    listen [::]:443 ssl;

    location / {
        proxy_pass      http://127.0.0.1:1337;
        include         proxy_params;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
Originally created by @gamelaster on GitHub (Aug 13, 2020). This is my nginx proxy pass configuration for planka (with SSL). ``` server { server_name planka.url; listen 443 ssl; listen [::]:443 ssl; location / { proxy_pass http://127.0.0.1:1337; include proxy_params; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ```
OVERLORD added the documentation label 2026-02-04 16:29:56 +03:00
Author
Owner

@ghost commented on GitHub (Aug 24, 2020):

Doesn't work for me. How does your docker-compose yml file looks like? 3000-> 1337?

@ghost commented on GitHub (Aug 24, 2020): Doesn't work for me. How does your docker-compose yml file looks like? 3000-> 1337?
Author
Owner

@gamelaster commented on GitHub (Aug 24, 2020):

@Git-Cluster

ports:
      - 127.0.0.1:1337:1337

So I just bind local 1337 port for 1337 port in container. Also, my docker-compose.yaml is based on original one without any much changes. (BTW, my nginx is running on host)

@gamelaster commented on GitHub (Aug 24, 2020): @Git-Cluster ```yaml ports: - 127.0.0.1:1337:1337 ``` So I just bind local 1337 port for 1337 port in container. Also, my docker-compose.yaml is based on original one without any much changes. (BTW, my nginx is running on host)
Author
Owner

@ghost commented on GitHub (Aug 24, 2020):

@Git-Cluster

ports:
      - 127.0.0.1:1337:1337

So I just bind local 1337 port for 1337 port in container. Also, my docker-compose.yaml is based on original one without any much changes. (BTW, my nginx is running on host)

This is what i have

ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337

I even tried
ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337

And the nginx config is exactly the same as yours

`
server {
server_name planka.test.com;

listen 443 ssl;                                                         
listen [::]:443 ssl;

location / {
    proxy_pass      http://127.0.0.1:1337;
    include         proxy_params;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

}
`

Websockets still ain't connected properly.

Mind if I get some help?

Thanks!

@ghost commented on GitHub (Aug 24, 2020): > @Git-Cluster > > ```yaml > ports: > - 127.0.0.1:1337:1337 > ``` > > So I just bind local 1337 port for 1337 port in container. Also, my docker-compose.yaml is based on original one without any much changes. (BTW, my nginx is running on host) This is what i have ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337` I even tried ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337` And the nginx config is exactly the same as yours ` server { server_name planka.test.com; listen 443 ssl; listen [::]:443 ssl; location / { proxy_pass http://127.0.0.1:1337; include proxy_params; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ` Websockets still ain't connected properly. Mind if I get some help? Thanks!
Author
Owner

@gamelaster commented on GitHub (Aug 24, 2020):

Please, can you check what is in your Devtools console (according to gif down)? There should be and error message.
2020-08-24_08-13-38

@gamelaster commented on GitHub (Aug 24, 2020): Please, can you check what is in your Devtools console (according to gif down)? There should be and error message. ![2020-08-24_08-13-38](https://user-images.githubusercontent.com/1665373/91009895-cc86a580-e5e1-11ea-9293-f574c1ceabbb.gif)
Author
Owner

@ghost commented on GitHub (Aug 24, 2020):

2websocket.js:124 WebSocket connection to 'wss://planka.test.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
p.doOpen @ websocket.js:124
3websocket.js:124 WebSocket connection to 'wss://planka.test.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
p.doOpen @ websocket.js:124
i.open @ transport.js:84
l.open @ socket.js:250
l @ socket.js:122
l @ socket.js:28
d.open.d.connect @ manager.js:226
(anonymous) @ manager.js:540

This is what I get, indeed it has an error.

@ghost commented on GitHub (Aug 24, 2020): ``` 2websocket.js:124 WebSocket connection to 'wss://planka.test.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 p.doOpen @ websocket.js:124 3websocket.js:124 WebSocket connection to 'wss://planka.test.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 p.doOpen @ websocket.js:124 i.open @ transport.js:84 l.open @ socket.js:250 l @ socket.js:122 l @ socket.js:28 d.open.d.connect @ manager.js:226 (anonymous) @ manager.js:540 ``` This is what I get, indeed it has an error.
Author
Owner

@gamelaster commented on GitHub (Aug 24, 2020):

Very strange. Are you sure that you reloaded your config? Also, which nginx version do you have?
This error happens when you don't have this code in your nginx location:

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
@gamelaster commented on GitHub (Aug 24, 2020): Very strange. Are you sure that you reloaded your config? Also, which nginx version do you have? This error happens when you don't have this code in your nginx location: ``` proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; ```
Author
Owner

@ghost commented on GitHub (Aug 24, 2020):

Very strange. Are you sure that you reloaded your config? Also, which nginx version do you have?
This error happens when you don't have this code in your nginx location:

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

Pretty sure, I did alot of googling and many are certain that this will remove the error but not for me.

@ghost commented on GitHub (Aug 24, 2020): > Very strange. Are you sure that you reloaded your config? Also, which nginx version do you have? > This error happens when you don't have this code in your nginx location: > > ``` > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection "upgrade"; > ``` Pretty sure, I did alot of googling and many are certain that this will remove the error but not for me.
Author
Owner

@meltyshev commented on GitHub (Aug 24, 2020):

This is what i have

ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337

I even tried
ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337

Hi, @Git-Cluster! BASE_URL should contain exactly the same host as server_name from nginx config. Try something like this: BASE_URL=https://planka.test.com (it should have an https scheme and without port).

@meltyshev commented on GitHub (Aug 24, 2020): > This is what i have > > ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337` > > I even tried > ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337` Hi, @Git-Cluster! `BASE_URL` should contain exactly the same host as `server_name` from nginx config. Try something like this: `BASE_URL=https://planka.test.com` (it should have an https scheme and without port).
Author
Owner

@ghost commented on GitHub (Aug 24, 2020):

This is what i have
ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337
I even tried
ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337

Hi, @Git-Cluster! BASE_URL should contain exactly the same host as server_name from nginx config. Try something like this: BASE_URL=https://planka.test.com (it should have an https scheme and without port).

Perfect, it works right now! Thanks everyone for the help!

@ghost commented on GitHub (Aug 24, 2020): > > This is what i have > > ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://127.0.0.1:1337` > > I even tried > > ` ports: - 127.0.0.1:1337:1337 environment: - BASE_URL=http://planka.test.com:1337` > > Hi, @Git-Cluster! `BASE_URL` should contain exactly the same host as `server_name` from nginx config. Try something like this: `BASE_URL=https://planka.test.com` (it should have an https scheme and without port). Perfect, it works right now! Thanks everyone for the help!
Author
Owner

@tricoos commented on GitHub (Jun 16, 2021):

Just in case - here is my working config:

nginx.conf

server {
    listen 80;
    server_name tasks.example.com tasks;
    return 301 https://tasks.example.com$request_uri;
}

map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
}

server {
        listen                  443 ssl;
        server_name             tasks.example.com;
        ssl_certificate         /certs/tasks.example.com.crt;
        ssl_certificate_key     /certs/tasks.example.com.key;

        if ($host != $server_name) {
            return 301 https://tasks.example.com$request_uri;
        }

        location /socket.io {
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection "upgrade";
              proxy_http_version 1.1;
              proxy_pass http://planka:1337/socket.io;
        }

        location / {
                proxy_pass http://planka:1337;
        }
}

in docker-compose.yml
BASE_URL=https://tasks.example.com

I never saw any 400 Bad Request in Chrome, however when I switched to Firefox I was finally able to see the 400 error. After then changing the BASE_URL and restarting the Docker container (!) it started working!

@tricoos commented on GitHub (Jun 16, 2021): Just in case - here is my working config: **nginx.conf** ``` server { listen 80; server_name tasks.example.com tasks; return 301 https://tasks.example.com$request_uri; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl; server_name tasks.example.com; ssl_certificate /certs/tasks.example.com.crt; ssl_certificate_key /certs/tasks.example.com.key; if ($host != $server_name) { return 301 https://tasks.example.com$request_uri; } location /socket.io { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_pass http://planka:1337/socket.io; } location / { proxy_pass http://planka:1337; } } ``` **in docker-compose.yml** `BASE_URL=https://tasks.example.com` I never saw any 400 Bad Request in Chrome, however when I switched to Firefox I was finally able to see the 400 error. After then changing the BASE_URL and restarting the Docker container (!) it started working!
Author
Owner

@pluveto commented on GitHub (Aug 22, 2022):

HTTP works but Websocket not

websocket.js:124 
        
       WebSocket connection to 'ws://***/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: 
f.doOpen @ websocket.js:124
o.open @ transport.js:84
l.open @ socket.js:250
l @ socket.js:122
l @ socket.js:28
p.open.p.connect @ manager.js:226
p @ manager.js:69
p @ manager.js:37
c @ index.js:60
(anonymous) @ sails.io.js:884
(anonymous) @ sails.io.js:861
u._connect @ sails.io.js:850
Xe.CALL @ redux-saga-core.esm.js:524
(anonymous) @ redux-saga-core.esm.js:1203
f @ redux-saga-core.esm.js:1271
d @ redux-saga-core.esm.js:1161
c @ redux-saga-core.esm.js:1251
n @ io-6de156f3.js:165
c @ redux-saga-core.esm.js:1251
(anonymous) @ redux-saga-core.esm.js:592
Ue @ redux-saga-core.esm.js:56
Xe.FORK @ redux-saga-core.esm.js:584
(anonymous) @ redux-saga-core.esm.js:1203
f @ redux-saga-core.esm.js:1271
(anonymous) @ redux-saga-core.esm.js:673
Xe.ALL @ redux-saga-core.esm.js:672
(anonymous) @ redux-saga-core.esm.js:1203
f @ redux-saga-core.esm.js:1271
d @ redux-saga-core.esm.js:1161
pt @ redux-saga-core.esm.js:1108
Xe.CALL @ redux-saga-core.esm.js:533
(anonymous) @ redux-saga-core.esm.js:1203
f @ redux-saga-core.esm.js:1271
d @ redux-saga-core.esm.js:1161
c @ redux-saga-core.esm.js:1251
Xe.CALL @ redux-saga-core.esm.js:539
(anonymous) @ redux-saga-core.esm.js:1203
f @ redux-saga-core.esm.js:1271
d @ redux-saga-core.esm.js:1161
pt @ redux-saga-core.esm.js:1108
(anonymous) @ redux-saga-core.esm.js:1367
Ue @ redux-saga-core.esm.js:56
ht @ redux-saga-core.esm.js:1366
u.run @ redux-saga-core.esm.js:1423
(anonymous) @ store.js:28
(anonymous) @ index.js:10
(anonymous) @ index.js:10
Show 17 more frames
websocket.js:124 
        
 
@pluveto commented on GitHub (Aug 22, 2022): HTTP works but Websocket not ``` websocket.js:124 WebSocket connection to 'ws://***/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: f.doOpen @ websocket.js:124 o.open @ transport.js:84 l.open @ socket.js:250 l @ socket.js:122 l @ socket.js:28 p.open.p.connect @ manager.js:226 p @ manager.js:69 p @ manager.js:37 c @ index.js:60 (anonymous) @ sails.io.js:884 (anonymous) @ sails.io.js:861 u._connect @ sails.io.js:850 Xe.CALL @ redux-saga-core.esm.js:524 (anonymous) @ redux-saga-core.esm.js:1203 f @ redux-saga-core.esm.js:1271 d @ redux-saga-core.esm.js:1161 c @ redux-saga-core.esm.js:1251 n @ io-6de156f3.js:165 c @ redux-saga-core.esm.js:1251 (anonymous) @ redux-saga-core.esm.js:592 Ue @ redux-saga-core.esm.js:56 Xe.FORK @ redux-saga-core.esm.js:584 (anonymous) @ redux-saga-core.esm.js:1203 f @ redux-saga-core.esm.js:1271 (anonymous) @ redux-saga-core.esm.js:673 Xe.ALL @ redux-saga-core.esm.js:672 (anonymous) @ redux-saga-core.esm.js:1203 f @ redux-saga-core.esm.js:1271 d @ redux-saga-core.esm.js:1161 pt @ redux-saga-core.esm.js:1108 Xe.CALL @ redux-saga-core.esm.js:533 (anonymous) @ redux-saga-core.esm.js:1203 f @ redux-saga-core.esm.js:1271 d @ redux-saga-core.esm.js:1161 c @ redux-saga-core.esm.js:1251 Xe.CALL @ redux-saga-core.esm.js:539 (anonymous) @ redux-saga-core.esm.js:1203 f @ redux-saga-core.esm.js:1271 d @ redux-saga-core.esm.js:1161 pt @ redux-saga-core.esm.js:1108 (anonymous) @ redux-saga-core.esm.js:1367 Ue @ redux-saga-core.esm.js:56 ht @ redux-saga-core.esm.js:1366 u.run @ redux-saga-core.esm.js:1423 (anonymous) @ store.js:28 (anonymous) @ index.js:10 (anonymous) @ index.js:10 Show 17 more frames websocket.js:124 ```
Author
Owner

@gamelaster commented on GitHub (Aug 22, 2022):

@pluveto Please post your nginx site config.

@gamelaster commented on GitHub (Aug 22, 2022): @pluveto Please post your nginx site config.
Author
Owner

@pluveto commented on GitHub (Aug 22, 2022):

@gamelaster
Exact same config as @tricoos 's but domain.
Finally resolved by reinstall containers without changing nginx config. I guess may be caused by a strange state of the running nodejs process.

@pluveto commented on GitHub (Aug 22, 2022): @gamelaster Exact same config as @tricoos 's but domain. Finally resolved by reinstall containers without changing nginx config. I guess may be caused by a strange state of the running nodejs process.
Author
Owner

@daniel-hiller commented on GitHub (Sep 23, 2023):

Sample NGIX configuration

https://docs.planka.cloud/docs/Configuration/webserver/NGINX

@daniel-hiller commented on GitHub (Sep 23, 2023): Sample NGIX configuration https://docs.planka.cloud/docs/Configuration/webserver/NGINX
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#13