G
G
gremlintv22018-07-11 13:21:56
Nginx
gremlintv2, 2018-07-11 13:21:56

How to escape such request?

We need requests that fall under the condition:
mysite.com/index.php?r=test
were proxied to another server
But for some reason it doesn’t work
like this:
location ^/index\.php\?r=test\/$ {
neither like this:
location ^ /index.php?r=test/$ {
not like this:
location ~ ^/index.php?r=test/$ {
Please tell me how to register correctly and what could be the problem.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila Vershinin, 2018-07-11
@gremlintv2

Location directives do not work with URL parameters in nginx.
You can try like this:

location ^/index\.php$ {
   if ($query_string ~ "r=test") {
     proxy_pass ...
   }
   ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question