LuCI behind reverse proxy on a subdirectory

i am currently running a self-built (and heavily modified) version of openwrt master
i have nginx as a webserver and reverse proxy set up. luci is running on nginx.
currently i can access luci (this is the default behavirour) in the root (e.g. https://IP/). i need to "move" luci to a subdirectory (not subdomain!) and access it like https://IP/router
i tried to set up another server and make aproxy_pass but it's not working.
the reason for this is that home assistant has a hard-coded path for each and every file and therefore needs to be served from /

1 Like

I'm currently looking for a very similar thing:

I have 3 OpenWRT devices, one as the router and two access points.

A Debian server on the network is running an nginx webserver to which the router forwards port 80+443 from the one public ip address.

I am able to make one of my OpenWRT devices accessible through the Debian nginx server used as a reverse proxy with this config snippet:

  location ~ ^/router/?(.*)$ {
    proxy_pass http://router-ip/$1;
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.htpasswd;
  }
  location ~/((luci-static|cgi-bin|ubus).*) {
    proxy_pass http://router-ip/$1;
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.htpasswd;
  }

And right there, that second block is what prevents me from adding reverse proxy configurations for the two access points as well - luci uses absolute links to those 3 directories, instead of relative ones.

@leonardpitzu Did you ever find a solution to your problem? Or does anybody else maybe have a hint on how to get luci to use relative instead of absolute links for the resources it requires?

Instead of modifying the URL paths, what about setting a unique DNS name for each device, all pointing to the same IP?

Then routing the traffic based on what DNS name's requested?

router.somesite.com -> 192.168.1.1
ap1.somesite.com -> 192.168.1.200
ap2.somesite.com -> 192.168.1.201