fix directory listing #2

Merged
maci0 merged 4 commits from patch-1 into main 2025-07-20 01:56:20 -04:00
maci0 commented 2025-07-20 01:15:06 -04:00 (Migrated from github.com)

Redirect /foo to /foo/ if it's a directory
This is standard behavior in HTTP servers (like Apache or nginx): if a directory is requested without a trailing slash, the server issues a 301 Moved Permanently redirect to the same path with a / added

Redirect /foo to /foo/ if it's a directory This is standard behavior in HTTP servers (like Apache or nginx): if a directory is requested without a trailing slash, the server issues a 301 Moved Permanently redirect to the same path with a / added
bahamas10 commented 2025-07-20 01:56:10 -04:00 (Migrated from github.com)

ah! good catch and good change!

yes, i can recreate this bug and definitely see the behavior you see. I tested against my website and a python simple http server and can verify the 301 behavior you mention:

$ python3 -mhttp.server &
$ curl -i localhost:8000/temp
HTTP/1.0 301 Moved Permanently
Server: SimpleHTTP/0.6 Python/3.13.3
Date: Sun, 20 Jul 2025 05:47:14 GMT
Location: /temp/
Content-Length: 0

Also my website (nginx behind cloudflare proxy):

$ curl -i ysap.sh/v
HTTP/1.1 301 Moved Permanently
Date: Sun, 20 Jul 2025 05:49:41 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://ysap.sh/v/
Server: cloudflare
...

Thanks for the change! i think the emoji is a pretty nice change too... LGTM

Screenshot 2025-07-20 at 1 55 05 AM
ah! good catch and good change! yes, i can recreate this bug and definitely see the behavior you see. I tested against my website and a python simple http server and can verify the 301 behavior you mention: ``` $ python3 -mhttp.server & $ curl -i localhost:8000/temp HTTP/1.0 301 Moved Permanently Server: SimpleHTTP/0.6 Python/3.13.3 Date: Sun, 20 Jul 2025 05:47:14 GMT Location: /temp/ Content-Length: 0 ``` Also my website (nginx behind cloudflare proxy): ``` $ curl -i ysap.sh/v HTTP/1.1 301 Moved Permanently Date: Sun, 20 Jul 2025 05:49:41 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive Location: http://ysap.sh/v/ Server: cloudflare ... ``` --- Thanks for the change! i think the emoji is a pretty nice change too... LGTM <img width="308" height="318" alt="Screenshot 2025-07-20 at 1 55 05 AM" src="https://github.com/user-attachments/assets/951b060d-4b88-416d-9718-8492e9cfe917" />
Sign in to join this conversation.
No description provided.