HTTP status for directories

Alejandro Colomar (man-pages) alx.manpages at gmail.com
Fri Mar 4 00:41:28 UTC 2022


Hi Valentin,

As I finished the implementation of "index" supporting an empty array, I
did some deep testing, and got something interesting.  It works as
expected, but there's still something that may not be what we want.

When a dir is requested, the behavior is different right now for the
following two cases:

user at ADY-debian-11:~/src/nginx/unit$ curl --dump-header - localhost/dir
HTTP/1.1 301 Moved Permanently
Location: /dir/
Server: Unit/1.27.0
Date: Thu, 03 Mar 2022 23:58:58 GMT
Content-Length: 0

user at ADY-debian-11:~/src/nginx/unit$ curl --dump-header - localhost/dir/
HTTP/1.1 404 Not Found
Content-Type: text/html
Server: Unit/1.27.0
Date: Thu, 03 Mar 2022 23:59:01 GMT
Content-Length: 54

<!DOCTYPE html><title>Error 404</title><p>Error 404.


The redirect makes sense, but we're not showing the 404 page after the
redirection.  It serves 0 bytes.  Is that correct?

Thanks,
Alex


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



More information about the unit mailing list