<div dir="ltr"><div>Does not work. <br></div><div><br></div><div>stream {<br> map $host $name {<br> plex.montclaire.lan app1;<br> transmission.montclaire.lan app2;<br> default default;<br> }<br> upstream app1 {<br> server <a href="http://127.0.0.1:32400" target="_blank">127.0.0.1:32400</a> max_fails=3 fail_timeout=10s;<br> }</div><div> upstream app2 {<br> server <a href="http://127.0.0.1:9091" target="_blank">127.0.0.1:9091</a> max_fails=3 fail_timeout=10s;<br> }</div><div> server {</div><div> listen <a href="http://172.16.0.5:80" target="_blank">172.16.0.5:80</a>;<br></div><div> listen <a href="http://172.16.0.5:443" target="_blank">172.16.0.5:443</a>;<br> proxy_pass $name;<br> ssl_preread on;<br> }<br> }</div><div><br></div><div>nginx[31436]: nginx: [emerg] unknown "host" variable<br>nginx[31436]: nginx: configuration file /etc/nginx/nginx.conf test failed<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 26, 2019 at 9:06 PM Phillip Odam <<a href="mailto:phillip.odam@nitorgroup.com">phillip.odam@nitorgroup.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hi Louis</p>
<p>The variable I think you're looking for is <span style="color:rgb(0,0,0);font-family:monospace;font-size:medium;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none">$host - </span><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;display:inline;float:none"><a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#variables" target="_blank">http://nginx.org/en/docs/http/ngx_http_core_module.html#variables</a></span></p>
<div class="gmail-m_-9012422345561227805moz-signature"><br>
</div>
<div class="gmail-m_-9012422345561227805moz-cite-prefix">On 8/26/19 8:55 PM, Louis Garcia wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>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.</div>
<div>Thanks.<br>
</div>
<div><br>
</div>
<div>stream {<br>
map $ssl_preread_server_name $name {<br>
plex.montclaire.lan app1;<br>
transmission.montclaire.lan app2;<br>
default default;<br>
}<br>
upstream app1 {<br>
server <a href="http://127.0.0.1:32400" target="_blank">127.0.0.1:32400</a>
max_fails=3 fail_timeout=10s;<br>
}</div>
<div> upstream app2 {<br>
server <a href="http://127.0.0.1:9091" target="_blank">127.0.0.1:9091</a> max_fails=3
fail_timeout=10s;<br>
}</div>
<div> server {</div>
<div> listen <a href="http://172.16.0.5:80" target="_blank">172.16.0.5:80</a>;<br>
</div>
<div> listen <a href="http://172.16.0.5:443" target="_blank">172.16.0.5:443</a>;<br>
proxy_pass $name;<br>
ssl_preread on;<br>
}<br>
}<br>
<br>
</div>
</div>
<br>
<fieldset class="gmail-m_-9012422345561227805mimeAttachmentHeader"></fieldset>
<pre class="gmail-m_-9012422345561227805moz-quote-pre">_______________________________________________
nginx mailing list
<a class="gmail-m_-9012422345561227805moz-txt-link-abbreviated" href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a>
<a class="gmail-m_-9012422345561227805moz-txt-link-freetext" href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></pre>
</blockquote>
</div>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote></div>