4 ms·
> The if directive is tricky to use, especially in location{} blocks. It often doesn’t do what you expect and can even cause segfaults. That's not user error.
by jrtc27 5y ago
> The if directive is tricky to use, especially in location{} blocks. It often doesn’t do what you expect and can even cause segfaults.
That's not user error. That's lazy programming and a bug. If your code segfaults because of user input you weren't expecting, that's on you as a programmer.
- mdaniel 5y agoIt wouldn't surprise me if they consider that WONTFIX given they wrote a whole wiki page entitled "If is Evil": https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ https://www.nginx.com/resources/wiki/start/topics/depth/ifis...
- jrtc27 5y agoOh I know. Hardly inspires confidence; all of those examples are clear bugs declared features because of poor programming practices.
- Dylan16807 5y agoI can understand why certain directives don't work inside an if, even if segfault is dumb. Why are the empty if blocks breaking things outside of them?