Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add map inside stream #385

Open
cs-zetsu opened this issue Nov 15, 2023 · 3 comments
Open

add map inside stream #385

cs-zetsu opened this issue Nov 15, 2023 · 3 comments
Labels
enhancement Enhance an existing feature

Comments

@cs-zetsu
Copy link

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: - string: $http_host variable: $name ...

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 alessfg added the enhancement Enhance an existing feature label Nov 15, 2023
@alessfg
Copy link
Collaborator

alessfg commented Nov 15, 2023

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
Copy link
Author

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

custom_directives
- map $ssl_preread_server_name $name {
- example.site1.srl web1;
- example.site2.srl web2;
- default none;
- "}"

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

@alessfg
Copy link
Collaborator

alessfg commented Nov 20, 2023

No worries! Glad you managed to get it working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance an existing feature
Projects
Development

No branches or pull requests

2 participants