Welcome! Log In Create A New Profile

Advanced

Re: Unit test for proxy_protocol

Greeshma A
September 21, 2021 10:48AM
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 <pluknet@nginx.com> wrote:

>
> > On 21 Sep 2021, at 07:56, Greeshma A <greeshma.avadhootha@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
Subject Author Views Posted

Unit test for proxy_protocol

Greeshma A 394 September 21, 2021 12:58AM

Re: Unit test for proxy_protocol

Sergey Kandaurov 119 September 21, 2021 05:44AM

Re: Unit test for proxy_protocol

Greeshma A 119 September 21, 2021 10:48AM

Re: Unit test for proxy_protocol

Sergey Kandaurov 102 September 21, 2021 10:56AM

Re: Unit test for proxy_protocol

Greeshma A 145 September 21, 2021 11:56AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

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