Welcome! Log In Create A New Profile

Advanced

Re: stream server name question

Phillip Odam
August 26, 2019 09:08PM
Hi Louis

The variable I think you're looking for is $host -
http://nginx.org/en/docs/http/ngx_http_core_module.html#variables


On 8/26/19 8:55 PM, Louis Garcia wrote:
> I am able to use $ssl_preread_server_name to get the server name. This
> is with https requests. Is there a corresponding embedded variable for
> http requests? I would like to setup streams to different backend
> servers based on http requests. Example below works for https but not
> http.
> Thanks.
>
> stream {
>         map $ssl_preread_server_name $name {
> plex.montclaire.lan app1;
> transmission.montclaire.lan app2;
>                                             default default;
>                                            }
>         upstream app1 {
>                        server 127.0.0.1:32400 http://127.0.0.1:32400
> max_fails=3 fail_timeout=10s;
>                       }
>         upstream app2 {
>                        server 127.0.0.1:9091 http://127.0.0.1:9091
> max_fails=3 fail_timeout=10s;
>                       }
>         server {
>                 listen 172.16.0.5:80 http://172.16.0.5:80;
>                 listen 172.16.0.5:443 http://172.16.0.5:443;
>                 proxy_pass $name;
>                 ssl_preread on;
>                }
>        }
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

stream server name question

Louis Garcia August 26, 2019 08:56PM

Re: stream server name question

Phillip Odam August 26, 2019 09:08PM

Re: stream server name question

Louis Garcia August 26, 2019 10:06PM

Re: stream server name question

Phillip Odam August 26, 2019 10:16PM

Re: stream server name question

Francis Daly August 30, 2019 03:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 49
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready