T
T
ThreeDHead2018-07-11 17:06:37
Nginx
ThreeDHead, 2018-07-11 17:06:37

Nginx, how to serve another page without a redirect?

For the 10.0.0.0/8 network, you need to give the regular index.html, and for other networks, index-inet.html
How to do this _without_ a redirect? For the server to stupidly give content from another file to other networks?
I did it, but there is an explicit redirect, it does not suit me:

location / {
                if ($remote_addr !~ "^10\.") {
                        rewrite ^/$ $scheme://$http_host/index-inet.html last;
                }
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2018-07-11
@BuriK666

take away$scheme://$http_host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question