Skip to content

caddyhttp: Fix panic when request missing ClientIPVarKey #6040

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

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

francislavoie
Copy link
Member

Reported in https://caddy.community/t/caddy-v2-health-check-with-php-fastcgi-not-working/22334

Health checks make a Request and try to log it with LoggableHTTPRequest. When trying to marshal it, we do GetVar(r.Context(), ClientIPVarKey).(string) which panics because we never set this var in context for health checks.

Fix is just to type assert in a guard instead of blindly using the value. Good enough.

@francislavoie francislavoie requested a review from mholt January 15, 2024 03:08
@francislavoie francislavoie added the bug 🐞 Something isn't working label Jan 15, 2024
@francislavoie francislavoie added this to the v2.8.0 milestone Jan 15, 2024
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.

Ope, thanks!

@francislavoie francislavoie enabled auto-merge (squash) January 24, 2024 00:40
@francislavoie francislavoie merged commit f5344f8 into master Jan 24, 2024
@francislavoie francislavoie deleted the fix-healthcheck-panic branch January 24, 2024 00:45
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