Welcome! Log In Create A New Profile

Advanced

proxying to upstream port based on scheme

Anoop Alias
October 05, 2016 09:06AM
I have an httpd upstream server that listen on both http and https at
different port and want to send all http=>http_upstream and https =>
https_upstream

The following does the trick

#####################
if ( $scheme = https ) {
set $port 4430;
}
if ( $scheme = http ) {
set $port 9999;
}

location / {

proxy_pass $scheme://127.0.0.1:$port;
}
#####################

Just wanted to know if this is very inefficient (if-being evil) than
hard-coding the port and having two different server{} blocks for http and
https .

Thanks in advance.



--
*Anoop P Alias*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxying to upstream port based on scheme

Anoop Alias October 05, 2016 09:06AM

Re: proxying to upstream port based on scheme

Valentin V. Bartenev October 05, 2016 11:34AM

Re: proxying to upstream port based on scheme

Edho Arief October 05, 2016 11:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
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