To cheat location in nginx


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
15 views
Is it possible to cheat location in nginx? Or rather, canonize whether nginx URI (and always)?

Let's say I want to restrict by IP the access to the directory files/private:
location ~ ^/files/private/.*$ {
if ($remote_addr != '127.0.0.1') {return 403;}
...
}

Understand that in this case it was possible to do without regular expressions. This is just an example.

The user can query as example.org/files/private/my.zipand http://example.org/files/./private/my.zip (common browsers automatically convert the second link). What does my location in the second case? If it works, it is always nginx canonicalize the URI before you run it by configuration? Somewhere in the documentation this is stated clearly?
by | 15 views

1 Answer

0 like 0 dislike
Try And Use X-Accel-Redirect
by
110,608 questions
257,186 answers
0 comments
22,649 users