Page 1 of 1

[Solved] How to configure reverse proxy with nginx?

Posted: Thu Apr 14, 2016 7:12 pm
by gurabli
Hi,

I'm having some real hard time to configure reverse proxy with nginx. I see many configurations, but I just can't make any of them work. Could you please post a howto for nginx with working configuration? I'm running deluged on Ubuntu Server 14.04. I have nginx installed. Please tell me exactly where to put what. I have a dynamic dns address that works fine.

I hope you can help me, it really drives me mad. I want to access webui with: dynamicdns.net/deluge from WAN.

Many thanks!

Re: How to configure reverse proxy with nginx?

Posted: Sun Apr 24, 2016 11:05 pm
by Cas

Re: How to configure reverse proxy with nginx?

Posted: Thu Jun 30, 2016 8:11 am
by gurabli
I have everything up and running, it is working fine with nginx, but the upload torrent file through webui doesn't work. Any ideas how could I resolve this?

Re: How to configure reverse proxy with nginx?

Posted: Thu Jun 30, 2016 9:48 am
by Cas
Look at the logs, could be permission related

Re: How to configure reverse proxy with nginx?

Posted: Thu Jun 30, 2016 12:02 pm
by gurabli
Nothing in logs, even with debug on. It looks it will be related to my nginx config. I stopped nginx and opened port 8112, accessed webui directly without reverse proxy and I could add files with upload. Now to troubleshoot why I can't add torrents using nginx reverse proxy, it will be a long road.

Interesting fact: I can add torrent with my Android phone with Transdroid, it works great, and I can also add over webui whit link, just file upload is not working. It must be something related to nginx permission or security setting. However, I don't get it how could Transdroid work, just browser not (tried ff, chrome, ie too).

Re: How to configure reverse proxy with nginx?

Posted: Thu Jun 30, 2016 1:15 pm
by gurabli
UPDATE & SOLVED:

After narrowing down the error to nginx, I finally found the problem. In order to prevent Clickjacking, everyone should use X-Frame-Options, like I do it too. Now this was set to DENY for my vhost where I run my Deluge reverse proxy. No wonder it prevented opening a page in frame or iframe -- like the webui upload.
It should be set to SAMEORIGIN, and everything is working as should. So the correct option, which is still very secure but doesn't limit functionality is:

Code: Select all

add_header X-Frame-Options SAMEORIGIN;
Transdroid was working fine with the same nginx config where X-Frame-Options were set to DENY since it doesn't open a new frame like webui does in browser.

Hope it will help others too!

Re: How to configure reverse proxy with nginx?

Posted: Thu Jun 30, 2016 1:23 pm
by Cas
Excellent, thanks for updating with that, I'll add it to wiki