Open PiTiLeZarD opened 4 years ago
While the quotes may not be necessary for this regex pattern, crossplane is not changing the behavior of this configuration by including them. If the request is not matching then I suspect fault lies else where.
Your expected behavior shows a pattern with the backslash to escape the "." stripped. Why do you expect that to happen?
First thanks for answering, and full disclosure, I'm far from an nginx expert. But I've discovered that my php rule wasn't matching properly with the quotes and was working fine without them.
Either way, if the original configuration doesn't have them, it'd be good for idempotence to have in and out matching I reckon, I'm happy to hear where I'm mistaken on this one.
Also I don't expect the backslash to disappear, I forgot to double escape the second one while writing the report, I've fixed the original bug report with the backslash in the "expected" section, sorry about that.
@PiTiLeZarD I tried out the config with and without quotes around \.php$
, but I couldn't find any difference in behavior with the two. Do you have an example url that would be routed by one but not the other?
Crossplane's build function is only intended to be idempotent as it pertains to the behavior of nginx. In other words, if you build a new config from a payload you previously parsed from an original config, the new config may look a bit different (e.g. indentation, blank lines, quotation), but nginx should act in exactly the same way when using either config.
Describe the bug I discovered while using crossplane that my locations weren't used by nginx due to quotes added in the build process
To Reproduce Here is a quick python example showing what I mean:
This will output: location ~ '\.php$' {
Expected behavior
I expect it to output: location ~ \.php$ { (without the quotes)
Your environment
Additional context
I fixed my issue by using location labels @php but It's hardly a solution. I haven't looked into the source code yet, let me know if I can be of any help.
Not sure if this is related to this other issue: https://github.com/nginxinc/crossplane/issues/82 if it is, you can close mine.