Serve index.html file if exists try_files + proxy_pass?
Lucas Rolff
lucas at lucasrolff.com
Sun Apr 30 10:44:21 UTC 2017
Hi guys,
I have a small scenario where I have a backend (s3 compatible storage), which by default generates a directory listing overview of the files stored.
I want to be able to serve an "index.html" file if the file exists, else just proxy_pass as normally.
https://gist.github.com/lucasRolff/c7ea13305e9bff40eb6729246cd7eb39
My nginx config for somewhat reason doesn't work – or maybe it's because I misunderstand how try_files actually work.
So I have URLs such as:
minio.box.com/bucket1/
minio.box.com/bucket43253/
When I request these URL's I want nginx to check if index.html exists in the directory (it's an actual file on the filesystem) - if it does, serve this one, else go to @minio location.
For any other file within the directory, I will just go to @minio location so if I request unicorn.png it should go in @minio location as well.
Is there any decent (non-evil) way of doing this?
I assume I have to define the root directive to make try_files work, but what would I actually have to define, to make nginx use try_files for index.html *within* the specific bucket?
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170430/4fd04547/attachment.html>
More information about the nginx
mailing list