[GH-ISSUE #77] Problem with conditionals #4474

Closed
opened 2026-03-01 15:33:31 +03:00 by kerem · 2 comments
Owner

Originally created by @kcholoren on GitHub (Feb 9, 2023).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/77

Hi, I found a problem that I think is new, because this configuration was already working, but yesterday I edited a Site and a problem appeared.
My configuration has several ifs inside the location part.
For example:

location /XXXX/ {
        proxy_pass YYYY
       ....
        if ($allowed_country = no) {        return 444; }
    }

But when I re-edit the site, in the editor it becomes:

location /XXXX/ {
        proxy_pass YYYY
       ....
        if ($allowed_country = no);
        return 444;
    }

And I get an error when I try to save:

Nginx Configuration Parse Error
nginx: [emerg] directive "if" has no opening "{" in /etc/nginx/sites-enabled/tkl-default:83 nginx: configuration file /etc/nginx/nginx.conf test failed 

Any ideas why?
Thank you!

Originally created by @kcholoren on GitHub (Feb 9, 2023). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/77 Hi, I found a problem that I think is new, because this configuration was already working, but yesterday I edited a Site and a problem appeared. My configuration has several **ifs** inside the _location_ part. For example: ``` location /XXXX/ { proxy_pass YYYY .... if ($allowed_country = no) { return 444; } } ``` But when I re-edit the site, in the editor it becomes: ``` location /XXXX/ { proxy_pass YYYY .... if ($allowed_country = no); return 444; } ``` And I get an error when I try to save: ``` Nginx Configuration Parse Error nginx: [emerg] directive "if" has no opening "{" in /etc/nginx/sites-enabled/tkl-default:83 nginx: configuration file /etc/nginx/nginx.conf test failed ``` Any ideas why? Thank you!
kerem 2026-03-01 15:33:31 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Feb 9, 2023):

Thank you for your report. This problem should be fix in 6b9ebbf, and the fix will be released in next version.

<!-- gh-comment-id:1424166805 --> @0xJacky commented on GitHub (Feb 9, 2023): Thank you for your report. This problem should be fix in 6b9ebbf, and the fix will be released in next version.
Author
Owner

@kcholoren commented on GitHub (Feb 9, 2023):

Thank you!

<!-- gh-comment-id:1424196941 --> @kcholoren commented on GitHub (Feb 9, 2023): Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#4474
No description provided.