Answer the question
In order to leave comments, you need to log in
Nginx - how to send half of the users to a different URI?
There are two modifications of the web application
/var/www/new_app
/var/www/old_app
root is set to /var/www
Url All users go to - example.com/old_app/index.html. This url cannot be changed yet.
Requests come to nginx /old_app/index.html
I would like to make half of the requests go to / new_app /index.html
Make
rewrite ^/old_app/index.html$ /new_app/index.html;
Not a problem.
But how to do it, some condition so that this happens for half of the requests. But not for everyone.
UPDATE1:
Thanks for the tips.
Another limitation fell on the task. For some applications, requests are proxied from third-party resources.
Therefore, some applications receive requests from the same ip and UA.
Therefore, ngx_http_split_clients_module is not very suitable for us. It is not clear on what parameter to separate requests.
Therefore, I decided to take Lindon_cano 's advice :
" 1. Make two more hosts in nginx listening to different ports on 127.0. the other, if you want a third and two-thirds, whatever you like. "
Answer the question
In order to leave comments, you need to log in
Look at what sharding is for a database, and then I think the essence will be clear to you. If there is no exact definition of who to send to the new url.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question