'NGINX add port and add suffix

On a pi 4 with node red installed i want to add port 1880 and /ui to url.

  • When the incoming connection is 10.0.0.0/24 ==> add /ui
  • When incoming other ==> add port 1880/ui

How to do it ?

I've searched the internet but haven't found anything similar.

Only found;

location / {     
proxy_pass http://127.0.0.1:1880;     
proxy_http_version 1.1;     
proxy_set_header Upgrade $http_upgrade;     
proxy_set_header Connection "upgrade";     
rewrite ^/(.*)$ /ui/$1 break;   }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source