News for hackers. Stuff that matters.
Re:Common Nginx misconfigurations that leave your web server... by c0l0 on Thursday February 25, 2021 @03:23AM (#26260842)
It's one of the shortcomings that I've come to loathe in nginx's declarative configuration language (and also other software products - Apache httpd is just as guilty). Everything just looks so innocent - but the devil is often in the details. So much implied nuance that you have to keep in mind when reading and especially when writing it.

Sure it's expressive and also convenient (the latter at least as long as your configuration stays relatively simple), but something like varnish's imperative VCL that offers very little built-in magic sure is easier to reason about. I have come to consider that a feature.

Re:Common Nginx misconfigurations that leave your web server... by mhitza on Thursday February 25, 2021 @05:12AM (#26261468)
Wouldn't it be nice if all these programs started using at some point a proper embedded language for configuration? Lua, Tcl, Guile.

I'd take any of those instead of the ad-hoc, declarative - but no really - languages that Apache and nginx use.

Re:Common Nginx misconfigurations that leave your web server... by feanaro on Thursday February 25, 2021 @05:57AM (#26261697)
That just seems like an even greater nightmare to me. Soon you would have to learn to read and understand a custom program in a Turing-complete language for each and every installation.

The proper solution is a DSL, just a better DSl. Or perhaps a DSL embedded in something like dhall <https://dhall-lang.org/>, but definitely not a general-purpose programming language.

Re:Common Nginx misconfigurations that leave your web server... by kevin_thibedeau on Thursday February 25, 2021 @02:36PM (#26267173)
Tcl is meant to be embedded for scripting and it can be made non-Turing complete by stripping away all but the bare minimum of commands. There is a built in mechanism for sandboxing untrusted input. If can easily be a safe, bullet proof configuration language.
Re:Common Nginx misconfigurations that leave your web server... by mhitza on Thursday February 25, 2021 @06:46AM (#26261907)
I was gonna consider including Dhall in my list, but then again nginx configuration has support for if statements.

And from my past experience with HCL, sometimes a proper embedded programming language is better than whatever crazy DSL some developers can envision (see for loops in HCL)

Re:Common Nginx misconfigurations that leave your web server... by PowerBar on Thursday February 25, 2021 @08:27PM (#26270544)
Whether JavaScript qualifies as a "proper embedded language" is up for debate, but nginx does support it for dynamic request handling. https://www.nginx.com/blog/introduction-nginscript/
Re:Common Nginx misconfigurations that leave your web server... by mhitza on Friday February 26, 2021 @02:57PM (#26279137)
That link is interesting for two reasons. First because of the feature you mentioned, and second because there is apparently a community lua module (nginx module implementation must be interesting if you can just attach a deeply embedded language via a module)

Somehow this didn't pop up on our search results (a couple of years back) when we were dealing with some tricky redirection patterns we had to implement. Would have made things much easier.