Welcome! Log In Create A New Profile

Advanced

Re: Reverse proxy to QNAP does not work

December 16, 2015 03:38PM
Hi Francis,

thanks for the details. I guess the trick is first to bypass a QNAP internal redirect to the NAS GUI (if possible or to integrate it on the first request). And second to to adapt the login request the right way. (btw: I try to avoid to change the qnap service, because of the regular QNAP firmware updates.)

For the first topic the internal network traffic analysis from Firefox shows a lot of GET requests and some POST regarding the login:
On the address bar a request of http://qnap/ will be redirected to http://qnap:8080/ >> http://qnap:8080/redirect.html?count=0.xxxx >> http://qnap:8080/cgi-bin/QTS.cgi?count=yyyyyy and finally to http://qnap:8080/cgi-bin/ which "delivers" the login page.
So, the service to enter the qnap is available at http://qnap:8080/cgi-bin/ (There are also other services available like the photo station (e.g. http://qnap:8080/photo or the music station, if activated).

I don't know why QNAP uses a redirect (I guess it has something to do with the QNAP webserver), so I concentrate on the second point: "Bypassing the redirect by request the login page directly" (which could be a good workaround).

So I tried it with http://qnap:8080/cgi-bin/login.html locally, which leads successfully to the login page http://qnap:8080/cgi-bin/. Changing the location part as suggested into:
location ^~ /nas/ {
proxy_pass http://qnap:8080/cgi-bin/;
proxy_set_header X-Real-IP $remote_addr;
}
and trying the address https://example.com/nas/login.html results in a broken login page with a lot of 404 errors.

Comparing the http headers of both login pages the one from the internal request contains a bit more. There is a additional Connection "Keep-Alive" and a Keep-Alive with "timeout=15, max=97" and another server name which is "http server 1.0" (that should be the QNAP internal server description) instead of "nginx/1.6.2" via the external request.
The content type of the GET requests doesn't change using the external address, it stays on html. Internal requests show different content types like css, js, xml, jpg.

Can anybody tell why it stays on external requests on content type "html"? Does it have to do something with Cache-Control?

I would appreciate any hint.

Kind regs

no.1
Subject Author Posted

Reverse proxy to QNAP does not work

no.1 November 25, 2015 03:31PM

Re: Reverse proxy to QNAP does not work

Francis Daly November 29, 2015 05:52AM

Re: Reverse proxy to QNAP does not work

no.1 December 16, 2015 03:38PM

Re: Reverse proxy to QNAP does not work

Francis Daly December 30, 2015 12:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready