Welcome! Log In Create A New Profile

Advanced

Re: Upstream to both https or http

Maxim Dounin
April 17, 2011 05:26AM
Hello!

On Sun, Apr 17, 2011 at 03:24:57AM -0400, speedfirst wrote:

> I have this requirement. I want to use nginx as the reverse proxy, which
> listen on address A and forward the request to the backend server with
> address B. However, if B is down, I want the request to be sent to
> address C. The question is, address B is https and address C is http.
> But for the argument of proxy_pass module, I can only write one prefix
> (either "http" or "https").
>
> upstream backend {
> server <addr B ip>:<addr B port>;
> server <addr C ip>:<addr C port> backup;
> }
>
> location / {
> proxy_pass http://backend; #here, only one prefix is allowed
> }
>
> So how to config to meet my requirements? Or here I shouldn't use
> upstream but other approach?

location / {
proxy_pass https://B;
error_page 502 504 = @fallback;
}

location @fallback {
proxy_pass http://C;
}

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Upstream to both https or http

speedfirst April 17, 2011 03:24AM

Re: Upstream to both https or http

edogawaconan April 17, 2011 03:42AM

Re: Upstream to both https or http

Peter Portante April 17, 2011 08:18AM

Re: Upstream to both https or http

SplitIce April 17, 2011 08:20AM

Re: Upstream to both https or http

Maxim Dounin April 17, 2011 05:26AM

Re: Upstream to both https or http

Peter Portante April 17, 2011 05:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 215
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready