Thanks for pointing to the variable I can use. What variable would capture the ip address and port number together? As far as I see, it's either the ip address or port? How can I combine them in the map definition? Can I put a colon in the map definition like follows
map $proxy_protocol_addr:$proxy_protocol_port $proxy_state{ } On Tue, Sep 21, 2021, 2:43 AM Sergey Kandaurov <pluk...@nginx.com> wrote: > > > On 21 Sep 2021, at 07:56, Greeshma A <greeshma.avadhoo...@gmail.com> > wrote: > > > > I am trying to test the following config : > > For proxy_protocol I have made changes in the nginx source code to > support variable input parameter as well. > > 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? > > ie something like > > map $remote_addr:$remote_port $proxy_state { > > # conditions > > } > > For destination you'd need $server_addr / $server_port variables. > See stream_map.t as a rough example. > You might also want to look at these variables: > $proxy_protocol_server_addr / $proxy_protocol_server_port. > All of them described on this page: > http://nginx.org/en/docs/stream/ngx_stream_core_module.html > > > > > stream { > > %%TEST_GLOBALS_STREAM%% > > > > map $ssl_preread_server_name $proxy_state{ > > default off; > > 127.0.0.1:8084 on; > > } > > > > server { > > listen 127.0.0.1:8080; > > proxy_pass 127.0.0.1:8081; > > proxy_protocol on; > > } > > > > server { > > listen 127.0.0.1:8082; > > proxy_pass 127.0.0.1:8081; > > proxy_protocol off; > > } > > > > server { > > listen 127.0.0.1:8083; > > proxy_pass 127.0.0.1:8081; > > proxy_protocol $proxy_state; > > } > > > > server { > > listen 127.0.0.1:8084; > > proxy_pass 127.0.0.1:8081; > > proxy_protocol $proxy_state; > > } > > } > > <nginx_proxy_protocol.txt>_______________________________________________ > > nginx-devel mailing list > > nginx-devel@nginx.org > > http://mailman.nginx.org/mailman/listinfo/nginx-devel > > -- > Sergey Kandaurov > > _______________________________________________ > nginx-devel mailing list > nginx-devel@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx-devel >
_______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel