-
Notifications
You must be signed in to change notification settings - Fork 165
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
NJS call wrong function. #700
Comments
Hi @mingkyme,
I am going to add some checks though to detect situations like this. |
Would be nice to have at least server{} block scoped vars. It's surprising that they're global. If this is impossible, then I guess the next best thing is to write a warning into the error log. |
@arut Roman, do you have an opinion about server{} scope nginx variables? |
The variables are global by design. It's hardly possible to change it without significant refactoring of nginx. To avoid such misconfigurations, it should be advised to place |
@arut I don't know about @mingkyme , but for me the reason for wanting server-scoped variables is to have generic NJS functions that need different configuration per server. Like in njs-acme: nginx/njs-acme#57. Without server-scoped variable, the only proper way to do that would be to create a separate function per server that calls the generic function with the server-specific config? |
Heya @NetForce1 -- A colleague suggested I explore using a map keyed by $host. I will hopefully have time to dig into this before the end of the week and will report back here how it might work with njs-acme. |
Hi @zsteinkamp, that might work, but has to be combined with $ssl_server_name for selecting the certificate for the tls connection, as $host is not yet set at that point.
|
When use same variable name, it called wrong function.
Here is an example.
curl -I 0 -H "Host: a" HTTP/1.1 200 OK Server: nginx/1.24.0 Date: Wed, 03 Apr 2024 04:14:50 GMT Content-Type: application/octet-stream Content-Length: 0 Connection: keep-alive X-A-Value: 2
The text was updated successfully, but these errors were encountered: