amazon s3 - nginx try_files with s3 bucket and proxy_pass for html pages without extension -
i have s3 bucket contains directories , html files. i'm using nginx in front of bucket , have configured proxy_pass bucket, works fine. want clean urls without html extension, , these urls resolve properly. example, instead of foo.com/bar/my-file-name.html
, must accessible @ foo.com/bar/my-file-name
the primary question here how prevent requiring .html @ end of every url. in, want nginx handle routing each requests , try looking file .html extension, , return it.
my problem can't figure out how force nginx try_files
on non-s3 site. when try , add configuration of try_files
, breaks site returning http 500 errors on paths.
for comparison, here configuration works great on non-s3 backed site (with files on server itself):
location / { try_files $uri $uri/ @htmlext; } location @htmlext { rewrite ^(.*)$ $1.html last; }
my goal replicate behavior proxy_pass
s3 bucket , force try filenames .html extension other index.html
, works out of box.
here current configuration works great, minus html files other index.html
:
location / { proxy_pass my-bucket.s3.blahblah/; }
Comments
Post a Comment