-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
A equivalent for nginx map module #2824
Comments
Is a literal map lookup all that is needed? Or do we have to consider fancy types of lookups like IP ranges? I ask because at scale the data structure matters significantly. Iterating a list of CIDR ranges for example is not efficient like a map lookup, but a hashmap lookup won't really do for CIDR ranges. Do you just need to map a string to some value? (When I say "you" I mean people who need this, in general -- I read the forum thread which you detailed pretty well for your case) |
Exactly, well it's like a string or regex search. That's the exact definition for the map module "The ngx_http_map_module module creates variables whose values depend on values of other variables." That's the config signature. Have you seen the doc |
Yep, I've seen it. But I frankly don't care what nginx does 😉 I want to know what your actual needs are. Regexp is tricky because we can't just do a simple hashmap lookup. We'd need a different data structure. I don't know of one that implements lookup capabilities like a hashmap that is faster than O(n). |
Okay. We also use the map for blocking requests like the below one.
And for redirecting like the example below.
Full Ack. https://hg.nginx.org/nginx/file/tip/src/http/modules/ngx_http_map_module.c#l527 Last time when I looked into the pattern matching was when I helped to integrate https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm into awffull https://salsa.debian.org/debian/awffull/blob/master/src/linklist.c but this is a string matching algorithm not a regex one. |
Excellent, thank you for the details!! I am excited to work on this more, but right now my priorities are finishing up logging, some needed enhancements to the TLS app, working on the admin endpoint, and adding more tests. In the meantime, feel free to continue discussion here and even submit a PR after that. Especially welcome would be specific implementation details for this feature. |
any update on this issue? |
Nope. It's not a priority right now, but we can get it implemented right away if you're able to fund its development. Right now our primary goal is to get 2.0 released. Let me know if you'd like us to develop this for you! |
Thank you for your offer, it's not as important as the last funded feature ( #2012 ) , therefore I will close the issue. |
I still want it eventually though so I'll keep this open :) |
1. What would you like to have changed?
This is the issue for https://caddy.community/t/whats-a-equivalent-for-nginx-map-module/6111/2
We use the nginx map for some dynamic directory decisions.
That's the config snipped.
2. Why is this feature a useful, necessary, and/or important addition to this project?
With the map is it possible to create dynamically routing decisions.
3. What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?
I still use nginx as webserver.
4. Please link to any relevant issues, pull requests, or other discussions.
https://caddy.community/t/whats-a-equivalent-for-nginx-map-module/6111
The text was updated successfully, but these errors were encountered: