HTTP status for directories
Alejandro Colomar (man-pages)
alx.manpages at gmail.com
Fri Mar 4 11:48:53 UTC 2022
On 3/4/22 01:57, Valentin V. Bartenev wrote:> It serves 0 bytes for the
"301 Moved Permanently", which is ok as any
> payload for the 301 code isn't displayed in browsers anyway.
>
> What do you mean by not showing the 404 page? The "curl" command just
> doesn't follow the redirect by default. In order to instruct curl to
> follow redirctions, you need to specify the -L option:
>
> curl -L localhost/dir
Ahh, your right, I was missing -L for the redirection.
It seems that it's working as it should:
user at ADY-debian-11:~$ curl -L --dump-header - localhost/dir
HTTP/1.1 301 Moved Permanently
Location: /dir/
Server: Unit/1.27.0
Date: Fri, 04 Mar 2022 11:47:10 GMT
Content-Length: 0
HTTP/1.1 404 Not Found
Content-Type: text/html
Server: Unit/1.27.0
Date: Fri, 04 Mar 2022 11:47:10 GMT
Content-Length: 54
<!DOCTYPE html><title>Error 404</title><p>Error 404.
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