planka icon indicating copy to clipboard operation
planka copied to clipboard

planka behind a nginx reverse proxy not working

Open santosh opened this issue 3 years ago • 15 comments

I am running the latest version of planka, straight from the master.

I have modified start script of client to serve it on port 3006. And here is part of my nginx configuration

location /planka/ {
    proxy_pass http://localhost:3006/;
}

This should serve the content on mydomain.com/planka. This does partially happens as I can see the index.html page being loaded at /planka/. But this is what I get in the console.

image


I have been in a similar situation with grafana, but luckily there is such a mechanism in grafana which allows hosting from sub path.

What are your views on this? Any workaround?

santosh avatar Apr 03 '21 14:04 santosh

I'm using apache for everything productive including reverse proxy stuff. But maybe Maks knows what to do here.

nickbe avatar Apr 04 '21 21:04 nickbe

This is my config, maybe it can help you.

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:3006;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

You also might have to append /planka/ to your BASE_URL setting

Zazama avatar Apr 08 '21 17:04 Zazama

I was struggling to get this to work, too. Finally got it working yesterday behind nginx.

This is my nginx related config:

location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;

                proxy_pass http://backend;

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

Backend should be outside of the server tag: (I used eth0 IPv4 address, but I guess localhost or 127.0.0.1 should suffice)

upstream backend {
        ip_hash;
        server 192.168.4.23:3000;
}

Also make sure to configure the docker-compose.yml accordingly. I had to configure the BASE_URL to the exact url that was configured in nginx. eg: BASE_URL=https://planka.example.com

rubenmdh avatar Apr 08 '21 18:04 rubenmdh

I still get the same error.

santosh avatar Apr 11 '21 12:04 santosh

I just yesterday deployed planka behind traefik, works like a charm, happy to share config if wished.

mortbauer avatar May 01 '21 13:05 mortbauer

I just yesterday deployed planka behind traefik, works like a charm, happy to share config if wished.

Please show the config. Thanks.

zhangrr avatar May 11 '21 03:05 zhangrr

@zhangrr I created a gist with the contents of my ansible role for planka, the traefik specific labels are araound line 88. Hope it helps.

mortbauer avatar May 14 '21 07:05 mortbauer

Seems like its only possible to reverse proxy planka to the root of a domain. I could not get a reverse proxy to https:'domain_here'/planka/ working... there is static/.... stuff missing...

image

reverse proxy to / on the domain is working fine.

janwels89 avatar Sep 09 '21 11:09 janwels89

I have a similiar problem, i use ngnix proxy manager, if i set the baseurl to the local ip4, it work (over the ip) if i set the url from nginx as baseurl, i stuck at the loading screen

Stadtschreck avatar Oct 16 '21 19:10 Stadtschreck

Think I'm having the same issue. I'm using Synology reverse proxy, eg. https://planka.domain.com. If BASE_URL is set to same I can access planka externally, however it fails internally at its docker address 192xxxx:xxxx. If I set BASE_URL to the internal address 192.xxxx:3000, I can access it there but not at planka.domain.com.

I've setup many other docker containers w/reverse proxy and don't have this issue. Should this work or is there a config needed?

soundneedle avatar Jan 10 '22 00:01 soundneedle

I am also having this issue. I placed it behind the Nginx server (non-docker version) and when it loads the page remotely, it's stuck loading. However, when I try it using localhost:3000, it loads up the sign-in page without issue.

Rykimaruh avatar Jan 21 '22 16:01 Rykimaruh

I have same issue (could not access static files after setting proxy to domain.com/planka) I would like to see "official" nginx setup example.

jitka avatar Mar 23 '22 09:03 jitka

For me it works without problem and without any custom configuration. Using this dockerized nginx reverse proxy for all of my services.

could not access static files after setting proxy to domain.com/planka

Never used that, maybe you can try to use a regular subdomain (planka.domain.com) instead?

ontheair81 avatar Mar 23 '22 10:03 ontheair81

location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
		proxy_pass         http://127.0.0.1:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
	}
location /socket.io/ {
		proxy_set_header   X-Real-IP $remote_addr;
		proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_pass         http://127.0.0.1:1337;
	        proxy_http_version 1.1;
	        proxy_set_header   Upgrade $http_upgrade;
		proxy_set_header   Connection "upgrade";
	}

I had to add a route for the websocket connection to fix the infinite loading.

Alumniminium avatar Apr 10 '22 14:04 Alumniminium

location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
		proxy_pass         http://127.0.0.1:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
	}
location /socket.io/ {
		proxy_set_header   X-Real-IP $remote_addr;
		proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_pass         http://127.0.0.1:1337;
	        proxy_http_version 1.1;
	        proxy_set_header   Upgrade $http_upgrade;
		proxy_set_header   Connection "upgrade";
	}

I had to add a route for the websocket connection to fix the infinite loading.

I'm using a synology NAS but I don't know where the problem is. I have created other proxies for other docker services without any problem. Could you add the docker-compose code?

djchoyr avatar Jun 20 '22 12:06 djchoyr

Hi everybody,

I installed Planka about 2 weeks ago to test it via Docker on my Synology NAS. I tried to set up a reverse proxy to use HTTPS instead of HTTP but it doesn't work !

In HTTPS I get to the login page and when I try to log in nothing happens after validating my credentials. However, if I do it in HTTP ...it's ok :(

The proxy on my NAS captures HTTPS on port 3017 and redirects HTTP on port 3000 to the localhost (NAS is Docker host). The Docker container has a port forwarding setting (port 3000 for the host to port 1337 for the container)

Here is my docker-compose if it can help to find what is wrong `version: '3'

services: planka: container_name: my-planka image: ghcr.io/plankanban/planka:latest command: > bash -c "for i in seq 1 30; do ./start.sh && s=$$? && break || s=$$?; echo "Tried $$i times. Waiting 5 seconds..."; sleep 5; done; (exit $$s)" restart: unless-stopped volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/private/attachments - /volume1/docker/planka/logs/:/app/logs/ ports: - 3000:1337 networks: netplanka: ipv4_address: 192.168.12.4 environment: - BASE_URL=https://myserver.mydomain:3017 - TRUST_PROXY=0 - DATABASE_URL=postgresql://postgres:xxxxxxxx@[email protected]/planka - SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx depends_on: - postgres

postgres: container_name: my-plankapostgres image: postgres:14-alpine restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust - POSTGRES_PASSWORD=XXXXXXXXXXX networks: netplanka: ipv4_address: 192.168.12.5

networks: netplanka: name: netplanka driver: bridge ipam: config: - subnet: 192.168.12.0/27 gateway: 192.168.12.1

volumes: user-avatars: project-background-images: attachments: db-data:`

I attach the capture from my browser (developer mode) Capture d’écran_2022-11-24_16-05-31

I tried to change BASE_URL to the address I use in my browser (https://myserver.mydomain:3000) but it doesn't work ! Many thanks

tikok974 avatar Nov 24 '22 15:11 tikok974

Do you add settings of websocket proxy to nginx?

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

mzch avatar Nov 24 '22 16:11 mzch

Hi mzch ! You are very nice ! That was good ! I added these parameters as shown in my screenshot below

Capture d’écran_2022-11-25_09-38-15 Capture d’écran_2022-11-25_08-51-00 Capture d’écran_2022-11-25_08-51-07 Capture d’écran_2022-11-25_08-51-41

...and put the real URL (the one i enter in my browser) in the BASE_URL variable of Planka and it works ! I hope it will also help other people ;) Thanks a lot for your help ;)

tikok974 avatar Nov 25 '22 08:11 tikok974