ngx-fancyindex
ngx-fancyindex copied to clipboard
Prevent 404 not found for custom header/footer
It'll be great if we can hide the 404 error for footer and header, just like apache2's index does :+1:
I understand that the use-case would be to be able to include README files as header/footer, but only if they exist, without letting the 404s end up being returned as part of the response. Is that right?
If that is the case, probably you want to use ngx_echo in combination with an internal subrequest location, and handle the 404 there instead (related: #17). The way I see this it, the resources pointed to by fancyindex_header and fancyindex_footer must always exist (otherwise it's is a configuration error), and if more complex logic than “always include those in the response” is needed, then one should script things using internal location subrequest.
Hi @aperezdc,
Thanks for your reply.
I understand that the use-case would be to be able to include README files as header/footer, but only if they exist, without letting the 404s end up being returned as part of the response. Is that right?
Sounds correct, my use-case is for ftp mirror hosting, some projects like Ubuntu will have header/footer, but some projects don't have that.
I'm not sure if using the ngx_echo will affect other normal access to header/footer, is it possible to let ngx-fancyindex hide the 404 without other configs?
Before deciding what to do about this issue, we need to figure out how using ngx_echo interacts with normal access to headers and footers.