{"action":"reopened","issue":{"url":"https://api.github.com/repos/mholt/caddy/issues/2310","repository_url":"https://api.github.com/repos/mholt/caddy","labels_url":"https://api.github.com/repos/mholt/caddy/issues/2310/labels{/name}","comments_url":"https://api.github.com/repos/mholt/caddy/issues/2310/comments","events_url":"https://api.github.com/repos/mholt/caddy/issues/2310/events","html_url":"https://github.com/mholt/caddy/issues/2310","id":365854019,"node_id":"MDU6SXNzdWUzNjU4NTQwMTk=","number":2310,"title":"Can't access files with hashes (#) if rewrites are being used","user":{"login":"ngyikp","id":6135313,"node_id":"MDQ6VXNlcjYxMzUzMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/6135313?v=4","gravatar_id":"","url":"https://api.github.com/users/ngyikp","html_url":"https://github.com/ngyikp","followers_url":"https://api.github.com/users/ngyikp/followers","following_url":"https://api.github.com/users/ngyikp/following{/other_user}","gists_url":"https://api.github.com/users/ngyikp/gists{/gist_id}","starred_url":"https://api.github.com/users/ngyikp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngyikp/subscriptions","organizations_url":"https://api.github.com/users/ngyikp/orgs","repos_url":"https://api.github.com/users/ngyikp/repos","events_url":"https://api.github.com/users/ngyikp/events{/privacy}","received_events_url":"https://api.github.com/users/ngyikp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-02T11:28:13Z","updated_at":"2018-10-03T22:13:39Z","closed_at":null,"author_association":"NONE","body":"### 1. What version of Caddy are you using (`caddy -version`)?\r\nCaddy 0.11.0 (non-commercial use only)\r\n\r\n### 2. What are you trying to do?\r\nI'm trying to serve a file with a hash in its file name, it doesn't work if I use `rewrite`\r\n\r\n### 3. What is your entire Caddyfile?\r\n```text\r\nhttp://127.0.0.1:2015\r\n\r\nroot /Users/ngyikp/Desktop/test\r\n\r\n# no need to run php, just a demo of a common config\r\nfastcgi / /run/php/php7.2-fpm.sock php\r\n\r\nrewrite {\r\n\t# if {file} not_has \"#\"\r\n\tto {path} {path}/ /index.php?{query}\r\n}\r\n```\r\n\r\n### 4. How did you run Caddy (give the full command and describe the execution environment)?\r\nOn macOS 10.14:\r\n`./caddy -conf /Users/ngyikp/Desktop/test/Caddyfile`\r\n\r\nOn the production server running Debian GNU/Linux 9.5:\r\n`/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp`\r\n\r\n### 6. What did you expect to see?\r\nIt should be possible to navigate to filenames with hashes on them\r\n\r\n### 7. What did you see instead (give full error messages and/or log)?\r\nAssuming the file \"#abc.htm\" contains a success message\r\n\r\n```\r\n$ http \"http://127.0.0.1:2015/%23abc.htm\"\r\nHTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nContent-Length: 34\r\nContent-Type: text/html; charset=utf-8\r\nDate: Tue, 02 Oct 2018 10:29:15 GMT\r\nEtag: \"pfyvl5y\"\r\nLast-Modified: Tue, 02 Oct 2018 10:24:41 GMT\r\nServer: Caddy\r\n\r\n<a href=\"%23abc.htm\">click me</a>\r\n```\r\n\r\nI found a workaround by excluding rewrites with hashes on the filename, if you uncomment the line in the `rewrite` section on my config, then it is possible to navigate to it\r\n\r\n```\r\n$ http \"http://127.0.0.1:2015/%23abc.htm\"\r\nHTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nContent-Length: 16\r\nContent-Type: text/html; charset=utf-8\r\nDate: Tue, 02 Oct 2018 10:29:04 GMT\r\nEtag: \"pfyvojg\"\r\nLast-Modified: Tue, 02 Oct 2018 10:26:43 GMT\r\nServer: Caddy\r\n\r\n<h1>Success</h1>\r\n```\r\n\r\n### 8. How can someone who is starting from scratch reproduce the bug as minimally as possible?\r\n```bash\r\necho '<a href=\"%23abc.htm\">click me</a>' > index.htm\r\necho '<h1>Success</h1>' > '#abc.htm'\r\n\r\n# launch caddy with the config\r\n# launch your web browser and browse to http://127.0.0.1:2015/index.htm\r\n# try to click the link\r\n```"}}
{"actor":{"display_login":"mholt"}}