Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Redirect cgi-bin directory

$
0
0
Dear Forum

I need your help because I'm stock on following issue:

I have a small portal on / there I have location which redirects me to an internal device in this Example my Router.

The Root rule is simple:

location / {
include /etc/nginx/naxsi.rules;
proxy_pass http://localhost:80;
proxy_read_timeout 90;
proxy_set_header Host $host;
}


No issue with that. Not I have a Location with redirect me to my Router GUI:

location /Router {
auth_basic "Restricted by NGINX";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://192.168.1.1;
rewrite ^/Router/(.*)$ /$1 break;
rewrite ^/cgi-bin/(.*)$ /cgi-bin/$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

It redirects but the Router reloads some cgi stuff: GET /cgi-bin/luci/web

For sure NGINX can't find anything on https://mydomina.com/cgi-bin/luci/web.
What I need is a rewrite rule that the get looks like this : GET /Router/cgi-bin/luci/web

Is this possible? Please note a new location /cgi-bin/ is not what I want because I have different devices who uses /cgi-bin.

Many thanks for your input / help.

Ben Gee

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>