Welcome! Log In Create A New Profile

Advanced

Proxy to App on another server using Sub-Folder

Posted by DeadalusHD 
Proxy to App on another server using Sub-Folder
September 14, 2021 09:12AM
Greetings,

I'm currently struggling to correctly proxy to an app on another server using nginx.
However I have an issue where as the proxy does not fully work and I get a 404 error from the other server,

This is my current nginx config for this specific case:

```
include includes/lb-realIPs.conf;

map $http_upgrade $connection_upgrade {

default upgrade;

'' close;
}

map $host $upstream_uicontroller {

default 10.0.0.7;

}

server {

listen 127.0.0.1:444 ssl proxy_protocol;

include includes/certs/cert-wildcard-nethavn.net.conf;
include includes/certs/ssl-base.conf;

server_name ui-controller.nethavn.net;

location ~/(ui)/ {
proxy_pass https://$upstream_uicontroller:8443;
proxy_http_version 1.1;

proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

allow 10.0.0.14;
allow 10.0.0.21;
deny all;
}

include includes/inc-nethavn.conf;
location ~ /\.ht {
deny all;
}
}

```
I tried many solutions on stackoverflow and Google but none are working.

Basic goal at the end is that I can call https://ui-controller.nethavn.net/ui/ and the app on the other server just adds their stuff after the /ui/ and works as if it would be in the root (/) path.

Can you please assit me here? Thanks!

Kind Regards,

Alex
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
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