镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Redirect to path+/ if path doesn't end with / - #2409

Open
luk1337 wants to merge 1 commit into
drogonframework:masterfrom
luk1337:luk/301slash
Open

luk1337 wants to merge 1 commit into
drogonframework:masterfrom
luk1337:luk/301slash

Conversation

@luk1337

@luk1337 luk1337 commented Nov 26, 2025 •

Copy link
Copy Markdown
Contributor

If HTML document uses relative paths, it'll fail to load them otherwise.

$ echo hello > index.html && mkdir test && echo world > test/index.html
$ curl -I http://127.0.0.1:8848
HTTP/1.1 200 OK
content-length: 13
content-type: text/html; charset=utf-8
server: drogon/1.9.11
date: Wed, 26 Nov 2025 13:09:28 GMT

$ curl -I http://127.0.0.1:8848/test
HTTP/1.1 301 Moved Permanently
content-length: 0
content-type: text/html; charset=utf-8
server: drogon/1.9.11
location: /test/
date: Wed, 26 Nov 2025 13:09:33 GMT

$ curl -I http://127.0.0.1:8848/test/
HTTP/1.1 200 OK
content-length: 6
content-type: text/html; charset=utf-8
server: drogon/1.9.11
accept-range: bytes
expires: Thu, 01 Jan 1970 00:00:00 GMT
last-modified: Wed, 26 Nov 2025 13:08:38 GMT
date: Wed, 26 Nov 2025 13:09:34 GMT

@luk1337
luk1337 force-pushed the luk/301slash branch 2 times, most recently from 6e66cbb to ba1b24c Compare November 26, 2025 13:40
If HTML document uses relative paths, it'll fail to load them otherwise.

$ echo hello > index.html && mkdir test && echo world > test/index.html
$ curl -I http://127.0.0.1:8848
HTTP/1.1 200 OK
content-length: 13
content-type: text/html; charset=utf-8
server: drogon/1.9.11
date: Wed, 26 Nov 2025 13:09:28 GMT

$ curl -I http://127.0.0.1:8848/test
HTTP/1.1 301 Moved Permanently
content-length: 0
content-type: text/html; charset=utf-8
server: drogon/1.9.11
location: /test/
date: Wed, 26 Nov 2025 13:09:33 GMT

$ curl -I http://127.0.0.1:8848/test/
HTTP/1.1 200 OK
content-length: 6
content-type: text/html; charset=utf-8
server: drogon/1.9.11
accept-range: bytes
expires: Thu, 01 Jan 1970 00:00:00 GMT
last-modified: Wed, 26 Nov 2025 13:08:38 GMT
date: Wed, 26 Nov 2025 13:09:34 GMT
@luk1337

luk1337 commented Dec 5, 2025

Copy link
Copy Markdown
Contributor Author

rebased to make CI fully green, no additional changes have been made.

This branch has not been deployed

No deployments
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.

1 participant