Welcome! Log In Create A New Profile

Advanced

subdirectory reverse proxy to root directory of internal proxy

Posted by davama 
subdirectory reverse proxy to root directory of internal proxy
March 05, 2018 04:47PM
Hello,

Im trying to configure a reverse proxy which would act as a frontend for all internal applications hosted on different servers. On the reverse proxy, each internal application would be served inside a sub-folder.

The URL scheme would be `https://frontend.net/internal_app` which would proxy to any `https://internal-app` or `https://internal-app/app`

For example:
server {
server_name frontend.net
location /app {
proxy_pass https://internal-service/app;
}
}


If i go straight to the internal app `https://login.nwk.jwm2.net` with my browser, my logs are so:
10.xxx.xx.202 - - [05/Mar/2018:21:28:05 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
10.xxx.xx.202 - - [05/Mar/2018:21:28:05 +0000] "GET /css/authelia.css HTTP/1.1" 304 0 "https://login.nwk.jwm2.net/" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
10.xxx.xx.202 - - [05/Mar/2018:21:28:05 +0000] "GET /js/authelia.js HTTP/1.1" 304 0 "https://login.nwk.jwm2.net/" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
10.xxx.x.202 - - [05/Mar/2018:21:28:05 +0000] "GET /img/icon.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
10.xxx.xx.202 - - [05/Mar/2018:21:28:05 +0000] "GET /img/user.png HTTP/1.1" 304 0 "https://login.nwk.jwm2.net/" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
10.xxx.xx.202 - - [05/Mar/2018:21:28:05 +0000] "GET /img/background.svg HTTP/1.1" 304 0 "https://login.nwk.jwm2.net/css/authelia.css" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

No issues there!

But through the reverse...

internal app logs:
10.xxx.xx.212 - - [05/Mar/2018:21:42:35 +0000] "GET / HTTP/1.0" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

reverse frontend logs:
xxxxx - - [05/Mar/2018:16:25:38 -0500] "GET /login HTTP/2.0" 401 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"
xxxxx - - [05/Mar/2018:16:25:52 -0500] "GET /login HTTP/2.0" 204 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36" "-"
xxxxx - - [05/Mar/2018:16:26:02 -0500] "GET /login HTTP/2.0" 401 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"
xxxxx- - [05/Mar/2018:16:27:35 -0500] "GET /login HTTP/2.0" 200 1784 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"
xxxxx - - [05/Mar/2018:16:27:35 -0500] "GET /css/authelia.css HTTP/2.0" 404 169 "https://squid-lab.nwk.jwm2.net/login" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"
xxxxx - - [05/Mar/2018:16:27:35 -0500] "GET /img/user.png HTTP/2.0" 404 169 "https://squid-lab.nwk.jwm2.net/login" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"
xxxxx - - [05/Mar/2018:16:27:35 -0500] "GET /js/authelia.js HTTP/2.0" 404 169 "https://squid-lab.nwk.jwm2.net/login" "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" "-"

My reverse proxy location is configured as such:
location /login {
rewrite /login(.*)$ /$1 break;
proxy_pass https://login.nwk.jwm2.net;
}

With the above configuration im able to get some data but not all images and scripts show/run properly.

Im feel it has something to do with my `rewrite` rule but cant figure it out....
Any input would be appreciated.


Thanks!
dave
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 177
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready