Skip to content

fix(middleware): handle CONNECT authority-form requests - #1162

Open
Fnine59 wants to merge 1 commit into
go-chi:masterfrom
Fnine59:fix/go-chi-807-connect-cleanpath
Open

fix(middleware): handle CONNECT authority-form requests#1162
Fnine59 wants to merge 1 commit into
go-chi:masterfrom
Fnine59:fix/go-chi-807-connect-cleanpath

Conversation

@Fnine59

@Fnine59 Fnine59 commented Aug 30, 2026

Copy link
Copy Markdown

What

Preserve chi's empty-path fallback for CONNECT authority-form requests when CleanPath is enabled.

Why

Go stores a CONNECT host:port target in URL.Host and leaves URL.Path empty. CleanPath currently writes path.Clean("") (.) into RouteContext.RoutePath, so the router no longer falls back to / and a CONNECT /* route returns 404.

Fixes #807

Verification

  • Add an authority-form regression test using httptest.NewRequest
  • Run the focused CleanPath tests
  • Run go test ./...

MARGINAL: This fixes a confirmed long-standing edge case, but maintainer interest is not yet confirmed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CleanPath middleware does not work correctly with http CONNECT requests

1 participant