Rewrite to a different host (round robin)

steve steve at greengecko.co.nz
Sun May 28 21:50:58 UTC 2017


Using the answer at 
https://serverfault.com/questions/597671/load-balancing-in-nginx-with-redirect-rather-than-proxy 
as a basis, why not set $loc_redirect to the upstream host name, and then

|location / { |||return 302 $scheme://$loc_redirect$request_uri;| }|

( although negating the stickiness of the upstream redirect may have the 
odd unwanted site effect ).

On 26/05/17 03:36, Jesus arteche wrote:
> I wouldn't like to consume bandwidth on the server with NGINX, and I 
> don't have DNS server ( I can not for technical reasons), so it has to 
> be IP rewrite or redirect :)
>
> On Thu, May 25, 2017 at 1:40 PM, Reinis Rozitis <r at roze.lv 
> <mailto:r at roze.lv>> wrote:
>
>     > Any idea how to do it?
>
>     Is there a reason why do you want to do it with nginx rather than
>     for example a simple DNS round robin?
>     (especially if as per your previous mail - you don't want to send
>     the traffic through the nginx loadbalancer)
>
>     rr
>
>     _______________________________________________
>     nginx mailing list
>     nginx at nginx.org <mailto:nginx at nginx.org>
>     http://mailman.nginx.org/mailman/listinfo/nginx
>     <http://mailman.nginx.org/mailman/listinfo/nginx>
>
>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

-- 
Steve Holdoway BSc(Hons) MIITP
https://www.greengecko.co.nz/
Linkedin: https://www.linkedin.com/in/steveholdoway
Skype: sholdowa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170529/43787836/attachment.html>


More information about the nginx mailing list