Skip to content

the change to SanitizedPathJoin in v2.8.x can cause routing to break in certain configurations  #6352

Closed
@elee1766

Description

@elee1766

in previous versions, this would work to route an SPA. i got this through google result showing matt's post here:

https://caddy.community/t/how-to-serve-a-single-page-app-spa-with-caddy-2/12770

:3838 {
        root * dir
	try_files {path} /
	file_server
}

however, in v2.8.0, this breaks. and must be replaced with

:3838 {
        root * dir
	try_files {path} /index.html
	file_server
}

after a git bisect, i find the commit where the behavior changed to be

6d97d8d87beb788d19a4084d07ec9157e5705b13 is the first bad commit
commit 6d97d8d87beb788d19a4084d07ec9157e5705b13
Author: Matt Holt <[email protected]>
Date:   Tue Apr 23 20:05:57 2024 -0400

    caddyhttp: Address some Go 1.20 features (#6252)

    Co-authored-by: Francis Lavoie <[email protected]>

 cmd/x509rootsfallback.go                     | 33 ++++++++++++++++++++++++++++
 go.mod                                       |  1 +
 go.sum                                       |  2 ++
 modules/caddyhttp/caddyhttp.go               | 13 +++++++++--
 modules/caddyhttp/caddyhttp_test.go          | 26 ++++++++++++++++------
 modules/caddyhttp/requestbody/caddyfile.go   | 26 +++++++++++++++++++++-
 modules/caddyhttp/requestbody/requestbody.go | 30 +++++++++++++++++++++++++
 modules/caddyhttp/responsewriter_test.go     | 10 ++++-----
 8 files changed, 125 insertions(+), 16 deletions(-)
 create mode 100644 cmd/x509rootsfallback.go

doing some more digging, but i thought i would raise this asap since perhaps other people were surprised by this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions