Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caddyfile: Stricter parsing, error for brace on new line #5505

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

francislavoie
Copy link
Member

Feedback from https://caddy.community/t/caddy-as-an-authentication-proxy-to-secure-endpoint/19691 made me realize we should be a bit stricter with parsing braces.

This makes this config cause an error:

:8001 {
    reverse_proxy https://example.com 
    {
        header_up Host {upstream_hostport}
    }
}
Error: Caddyfile.test3:3 - Error during parsing: Unexpected '{' on a new line; did you mean to place the '{' on the previous line?

The other changes to reverse_proxy/php_fastcgi/forward_auth were to fix the error expecting 'https://' but got '://' from that thread; essentially, the upstreams were being parsed for each iteration of the unmarshal loop with RemainingArgs() but that doesn't make sense. Changing the loop means both the shortcut directives would misbehave due to the dispenser cursor being in the wrong place, so they need to be advanced before calling down.

@francislavoie francislavoie requested a review from mholt April 20, 2023 10:03
@francislavoie francislavoie added the bug 🐞 Something isn't working label Apr 20, 2023
@francislavoie francislavoie added this to the v2.7.0 milestone Apr 20, 2023
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Wow. Thanks for the improvement!!

@mholt mholt enabled auto-merge (squash) April 20, 2023 17:07
@mholt mholt merged commit 53b6fab into master Apr 20, 2023
@mholt mholt deleted the stricter-braces branch April 20, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants