How catch search request to WordPress on nginx and send it via location?

The crux of the matter the following on nginx is configured to route the following:
location = / {
 proxy_pass http://localhost:9000;
...
}

 location / {
 try_files $uri $uri/ /index.php?$args ;
 }

Accordingly, the query includes only the domain are handled samopisnom on the go-server, the other predrasuda on wordpress.
The problem is that search queries are sent to a WordPress url domain.ru/?s=... and forwarded on to go server.
Question - how on the nginx level to catch get requests like /?s=... and redirect to wordpress?
I think that this can be done using if ($args ~ ^get=s$ ) or something like that, but working config yet to collect failed.
March 23rd 20 at 19:30
1 answer
March 23rd 20 at 19:32
Solution
location = / {
 if ($arg_s) {
 rewrite ^ /index.php last;
}
 proxy_pass http://localhost:9000;
...
}


But it would be better just to use a different address.
Thank you! - Terr commented on March 23rd 20 at 19:35

Find more questions by tags WordPressNginx