I am trying to load an Angular app from another internal service when calling localhost:81/internal?pageId=10. But all that happens is that nginx redirect me in the browser to localhost:80.
I have this configuration:
location ~ /internal(?<section>.+) {
proxy_pass http://192.168.1.100:8080/public/internal$section;
proxy_set_header Host $host;
}
As I've read in multiple other questions, that should work, but for some reason nginx redirects me to port 80.
Request headers:
GET /internal/?pageId=10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Connection: keep-alive
Host: localhost:81
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36
Response headers:
HTTP/1.1 302 Found
Server: nginx/1.21.6
Date: Thu, 19 May 2022 09:15:34 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://localhost/public/internal?pageId=10
X-Powered-By: Jetty(9.4.40.v20210413)
Is this even possible? And if so, how do I fix this?