8000 Trailing Slash In Path differences · Issue #325 · mjl-/mox · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Trailing Slash In Path differences #325

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

Open
odama626 opened this issue Mar 28, 2025 · 1 comment
Open 8000

Trailing Slash In Path differences #325

odama626 opened this issue Mar 28, 2025 · 1 comment

Comments

@odama626
Copy link

I just noticed an oddity that took me a bit to figure out, it's just a nitpick though, this is a fantastic project.

AccountHTTPS:
Path: /account

returns a 404

AccountHTTPS:
Path: /account/

returns page

WebmailHTTPS:
Path: /webmail

and
Path: /webmail/

both returns page

the difference is, I noticed that AccountHTTPS paths without the trailing / don't work, but they do for webmail

mjl- added a commit that referenced this issue Mar 29, 2025
…d in a slash to prevent 404's and/or errors accessing the web interfaces

The default paths for the web interfaces, such as /admin/, /account/, /webmail/
and /webapi/ end with a slash. They should end with a slash because we use the
path when restricting cookies to just that web interface. You could configure
paths not ending with a slash, but due to using http.StripPrefix, and our
handler, some of those requests may not work properly.

We now warn if configured paths don't end with a trailing slash when parsing
the config file. We normally error out when such things happen, but users
probably have paths without trailing slashes configured, and we don't want to
break them on a future upgrade. We now use an effective path that includes the
trailing slash.

We would always redirect requests to the configured paths but without trailing
slash to the path with trailing slash, and that stays.

For issue #325 by odama626.
@mjl-
Copy link
Owner
mjl- commented Mar 29, 2025

Thanks for reporting @odama626! The paths should have an effective path ending in a slash, if only for proper cookiepath handling. I've changed the config parser to ensure the effective paths registered always end with a slash. We were already redirecting requests for paths without trailing slash to paths with trailing slash. The commit message has a few more details. If you want to test this now works as intended, you could compile or download mox with this commit, and run "mox localserve" and change the mox.conf to check the behaviour is now less error-prone.

See https://www.xmox.nl/b/#3e128d744e7fc7466638aa3367e54ab8a9c180a0

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

No branches or pull requests

2 participants
2A94
0