Closed
Description
Multiple forward slashes are not collapsed in paths
1. What version of Caddy are you using (caddy -version
)?
Caddy 0.10.7
2. What are you trying to do?
Use path matches with status
, rewrite
and internal
.
3. What is your entire Caddyfile?
:8001 {
status 401 /secret/files
}
:8002 {
rewrite /secret/files {
regexp ^/(.*)
to /notsecret/files/{1}
}
}
:8003 {
internal /secret/files
}
4. How did you run Caddy (give the full command and describe the execution environment)?
caddy
with no arguments, Windows 64 bit
5. Please paste any relevant HTTP request(s) here.
curl localhost:8001/secret/files/file.txt
returns 401 as expectedcurl localhost:8001//secret//files/file.txt
serves the secret file (all variations of multiple slashes serves the file.curl localhost:8002/secret/files/file.txt
serves the public file after rewriting, as expectedcurl localhost:8002/secret//files/file.txt
serves the secret filecurl localhost:8003/secret/files/file.txt
returns 404 as expectedcurl localhost:8003/secret//files/file.txt
serves the secret file.
6. What did you expect to see?
That multiple slashes in the path was collapsed or matched by the path expressions.
7. What did you see instead (give full error messages and/or log)?
They were not
8. How can someone who is starting from scratch reproduce the bug as minimally as possible?
I have attached a small test site as a zip.
caddy_bug.zip