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

Parsing error with new protocols directive #5053

Closed
ueffel opened this issue Sep 20, 2022 · 3 comments · Fixed by #5054 or #5126
Closed

Parsing error with new protocols directive #5053

ueffel opened this issue Sep 20, 2022 · 3 comments · Fixed by #5054 or #5126
Labels
bug 🐞 Something isn't working
Milestone

Comments

@ueffel
Copy link
Contributor

ueffel commented Sep 20, 2022

The new protocols subdirective in servers is only excepted when it is the last directive in the servers block. Is that intended?

Example Caddyfile:

{
	servers :443 {
		protocols h1 h2 h3
		strict_sni_host insecure_off
	}
}

or

{
	servers :443 {
		protocols h1 h2 h3
		log_credentials
	}
}

Produces errors:

Error: adapting config using caddyfile: parsing caddyfile tokens for 'servers': Caddyfile:4 - Error during parsing: Wrong argument count or unexpected line ending after 'strict_sni_host'
Error: adapting config using caddyfile: parsing caddyfile tokens for 'servers': Caddyfile:4 - Error during parsing: Wrong argument count or unexpected line ending after 'log_credentials'

This works though:

{
	servers :443 {
		log_credentials
		protocols h1 h2 h3
	}
}

Related pull request: #4707

Tested version: v2.6.0-beta.5

@francislavoie
Copy link
Member

Yep, I see the issue. Thanks! Pushing a fix in a sec.

@danlsgiga
Copy link
Contributor

Hey folks, just spotted this same issue but with a different directive:

NOT WORKING

{
  servers {
    metrics
    strict_sni_host insecure_off
  }
}

Error: adapting config using caddyfile: parsing caddyfile tokens for 'servers': Caddyfile:14 - Error during parsing: Wrong argument count or unexpected line ending after 'strict_sni_host'

WORKING

{
  servers {
    strict_sni_host insecure_off
    metrics
  }
}

@francislavoie
Copy link
Member

Thanks @danlsgiga, got it 👍

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
3 participants