<div dir="auto"><div dir="auto">Thanks for pointing to the variable I can use.</div><div dir="auto"><br></div>What variable would capture the ip address and port number together?<div dir="auto">As far as I see, it's either the ip address or port?</div><div dir="auto">How can I combine them in the map definition?</div><div dir="auto">Can I put a colon in the map definition like follows</div><div dir="auto"><br></div><div dir="auto">map $proxy_protocol_addr:$proxy_protocol_port $proxy_state{</div><div dir="auto"><br></div><div dir="auto">}</div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 21, 2021, 2:43 AM Sergey Kandaurov <<a href="mailto:pluknet@nginx.com">pluknet@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On 21 Sep 2021, at 07:56, Greeshma A <<a href="mailto:greeshma.avadhootha@gmail.com" target="_blank" rel="noreferrer">greeshma.avadhootha@gmail.com</a>> wrote:<br>
> <br>
> I am trying to test the following config : <br>
> For proxy_protocol I have made changes in the nginx source code to support variable input parameter as well. <br>
> Im writing unit tests for this. However, Im not sure how to configure the map directive. The variable   $ssl_preread_server_nameis wrong. I need to give the destination address and port. What would I have to give in the key part of the map definition? <br>
> ie something like <br>
> map $remote_addr:$remote_port $proxy_state {<br>
> # conditions<br>
> }<br>
<br>
For destination you'd need $server_addr / $server_port variables.<br>
See stream_map.t as a rough example.<br>
You might also want to look at these variables:<br>
$proxy_protocol_server_addr / $proxy_protocol_server_port.<br>
All of them described on this page:<br>
<a href="http://nginx.org/en/docs/stream/ngx_stream_core_module.html" rel="noreferrer noreferrer" target="_blank">http://nginx.org/en/docs/stream/ngx_stream_core_module.html</a><br>
<br>
> <br>
> stream {<br>
>     %%TEST_GLOBALS_STREAM%%<br>
> <br>
>     map $ssl_preread_server_name $proxy_state{<br>
>         default off;<br>
>         <a href="http://127.0.0.1:8084" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8084</a> on;<br>
>     }<br>
> <br>
>     server {<br>
>         listen          <a href="http://127.0.0.1:8080" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8080</a>;<br>
>         proxy_pass      <a href="http://127.0.0.1:8081" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8081</a>;<br>
>         proxy_protocol on;<br>
>     }<br>
> <br>
>     server {<br>
>         listen          <a href="http://127.0.0.1:8082" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8082</a>;<br>
>         proxy_pass      <a href="http://127.0.0.1:8081" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8081</a>;<br>
>         proxy_protocol  off;<br>
>     }<br>
> <br>
>     server {<br>
>         listen          <a href="http://127.0.0.1:8083" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8083</a>;<br>
>         proxy_pass      <a href="http://127.0.0.1:8081" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8081</a>;<br>
>         proxy_protocol  $proxy_state;<br>
>     }<br>
> <br>
>     server {<br>
>         listen          <a href="http://127.0.0.1:8084" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8084</a>;<br>
>         proxy_pass      <a href="http://127.0.0.1:8081" rel="noreferrer noreferrer" target="_blank">127.0.0.1:8081</a>;<br>
>         proxy_protocol  $proxy_state;<br>
>     }<br>
> }<br>
> <nginx_proxy_protocol.txt>_______________________________________________<br>
> nginx-devel mailing list<br>
> <a href="mailto:nginx-devel@nginx.org" target="_blank" rel="noreferrer">nginx-devel@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
<br>
-- <br>
Sergey Kandaurov<br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank" rel="noreferrer">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote></div>