I am looking for a way to configure httpd server to respond with an image if requested file is not found. I know it can be simply done by:
ErrorDocument 404 "/static/thumbnails/404.png"
This one works, but a server responds with 404 code and it is something that I am trying to get rid of (ideally if a server would return 200).
I have tried doing a simple redirect as follows:
Redirect "for/sure/doesnt/exist" "/static/thumbnails/blank-thumbnail.png" ErrorDocument 404 "/for/sure/doesnt/exist"
But it doesn't work (and even if it worked - it would return 302 response) as it's what is returned for
Not Found The requested URL /static/thumbnails/any was not found on this server.
Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request.
What is interesting, Apache log says that status code for this response is 302:
[16/Jan/2018:08:39:56 -0500] "GET /static/thumbnails/any HTTP/1.1" 302 - "-" "curl/7.47.0"
So it looks that
Redirect actually worked, but I am also sure that
"/static/thumbnails/blank-thumbnail.png" path is correct.
Is there any way, without scripting, to serve a defined static resource (an image in my case) if requested one is not found (instead of returning 404)?