I have CGIhandler = /var/www/cgi-bin/url.sh:url
the contents of url.sh are:
#!/bin/sh
#TODO idk
status="302 Found"
#TODO parsing of other than raw-plaintext .URL files
if true; then
url="$(cat "${1}")"
fi
printf 'Status: %s\nLocation: %s\n\n' "${status}" "${url}"
cat "${1}"
and additionally I have it enabled in cgi-wrapper.conf.
This seemingly works perfectly; for instance, I can just run, as my user:
echo "http://website.org/favorite_page" > ~/public_html/bookmarks/website_page.url
to create a "hyperlink" to that page in the directory listing, which works very well:
$ curl -sv http://www.example.com/~james/bookmarks/website_page.url
* Trying ::1...
* TCP_NODELAY set
* Connected to www.example.com (::1) port 80 (#0)
> GET /~james/bookmarks/website_page.url HTTP/1.1
> Host: www.example.com
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Tue, 23 Jan 2018 23:35:54 GMT
< Server: Hiawatha v10.7
< Connection: keep-alive
< Transfer-Encoding: chunked
< Location: http://website.org/favorite_page
<
http://website.org/favorite_page
* Curl_http_done: called premature == 0
* Connection #0 to host www.example.com left intact
$
However, if I try to visit for instance http://www.example.com/~james/bookmarks/asdflmaofilenotfound.url
I get a 404 error, but not a "clean" one:
curl -sv http://www.example.com/~james/bookmarks/asdflmaofilenotfound.url
* Trying ::1...
* TCP_NODELAY set
* Connected to www.example.com (::1) port 80 (#0)
> GET /~james/bookmarks/asdflmaofilenotfound.url HTTP/1.1
> Host: www.example.com
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Tue, 23 Jan 2018 23:38:33 GMT
< Server: Hiawatha v10.7
< Connection: keep-alive
< Transfer-Encoding: chunked
<
* Curl_http_done: called premature == 0
* Connection #0 to host www.example.com left intact
That is, instead of just displaying the usual Hiawatha 404 error page, there's a suspicious blank page.
So, I am wondering, what do I need to do to get a "Normal" 404 page for URLs ending in a CGI extension?