nginxinc / ansible-role-nginx-config

Ansible role for configuring NGINX
https://galaxy.ansible.com/nginxinc/nginx_config
Apache License 2.0
157 stars 73 forks source link

add map inside stream #385

Open cs-zetsu opened 11 months ago

cs-zetsu commented 11 months ago

Is your feature request related to a problem? Please describe

We use the stream module for reverse proxy ssl connection, so we need something like this: ` stream {

upstream web1 {
    server https://thatserver.org;
}
upstream web2 {
    server https://otherserver.org;
}
upstream thisone{
    server https://localhost:8443;
}

map $ssl_preread_server_name $name {
    thatserver.org web1;
    otherserver.org web2;
    default thisone;
}

server {
    listen 443 ;
    listen [::]:443 ;

    proxy_pass $name;
    ssl_preread on;
    proxy_protocol on;
}

} `

AFAK, in http module there is the map statement: `map: hash_bucket_size: 128 hash_max_size: 4096 mappings:

But there is none in stream module.

Describe the solution you'd like

use the map in stream module as there is in http module

Describe alternatives you've considered

For now, we will use the custom_directives, or try to do it using a local branch

Additional context

Add any other context or screenshots about the feature request here.

alessfg commented 11 months ago

I'll add it to the backlog! In the meantime, I would suggest using the custom_directives parameter to workaround not having map support in the stream context 😄

cs-zetsu commented 10 months ago

Yes, for now we're using the custom-directive and is working

custom_directives

P.S. Tab, is wrong, i could not understand how to use the "code" in markdow... sorry XD

alessfg commented 10 months ago

No worries! Glad you managed to get it working!