T
T
tem12qaz2021-06-26 22:12:06
Nginx
tem12qaz, 2021-06-26 22:12:06

How to implement redirect depending on header and path?

I need a redirect to a particular url depending on the path and title (or rather the OS in the title).
For example, /search redirects to yandex from an iPhone and to google from an android.
How can this be implemented?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2021-06-26
@ky0

Make conditions with regular expressions that bypass the corresponding heading. But in general, this is not the most kosher way to use nginx - usually such logic is left inside the application.

D
Dmitry, 2021-06-26
@q2digger

I think map will help, https://nginx.org/en/docs/http/ngx_http_map_module.html
Substituting one value based on another is exactly what it is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question