[GH-ISSUE #48] bug:unexpected token BlockEnd (}) #24

Closed
opened 2026-02-28 01:20:33 +03:00 by kerem · 1 comment
Owner

Originally created by @Nobilta on GitHub (Jun 26, 2024).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/48

If another block, such as an if statement, is included at the end of a block, it will prompt "unexpected token BlockEnd (})". However, if the if statement is moved to the beginning of the block, this issue does not occur.

//issue occur code unexpected token BlockEnd (}) on line 12, column 5
location  / {
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        include common_headers.conf;
        if ($res > $gray){
            proxy_pass http://a;
        }
        if ($res <= $gray){
            proxy_pass http://b;
        }
}
//no issue code
location  / {
        if ($res > $gray){
            proxy_pass http://a;
        }
        if ($res <= $gray){
            proxy_pass http://b;
        }
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        include common_headers.conf;
}
Originally created by @Nobilta on GitHub (Jun 26, 2024). Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/48 If another block, such as an if statement, is included at the end of a block, it will prompt "unexpected token BlockEnd (})". However, if the if statement is moved to the beginning of the block, this issue does not occur. ``` //issue occur code unexpected token BlockEnd (}) on line 12, column 5 location / { proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; include common_headers.conf; if ($res > $gray){ proxy_pass http://a; } if ($res <= $gray){ proxy_pass http://b; } } ``` ``` //no issue code location / { if ($res > $gray){ proxy_pass http://a; } if ($res <= $gray){ proxy_pass http://b; } proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; include common_headers.conf; } ```
kerem closed this issue 2026-02-28 01:20:33 +03:00
Author
Owner

@tufanbarisyildirim commented on GitHub (Jul 5, 2024):

that's an interesting catch, thanks @Nobilta !

<!-- gh-comment-id:2210875659 --> @tufanbarisyildirim commented on GitHub (Jul 5, 2024): that's an interesting catch, thanks @Nobilta !
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/gonginx#24
No description provided.