-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Guys,
Want to bring up old question.
It’s not a bug, I’m just trying to understand behavior and find right course of actions.
I did lots of Googling, but didn’t find definitive answer.
(Openresty version is at the very bottom of the post.)
In short:
Static files are stored on Azure storage.
There is a "location" configured for such files which performs uri rewrite, adds sas token to and does
proxy_pass http://qamfiles.file.core.windows.net;
It works fine.
The only wrinkle is "Content-Type" returned by proxy (i.e. Azure storage http endpoint) is "application/octet-stream" always.
Requested file extension is known and proper "Content-Type" can be set easily from header_filter_by_lua_file code.
Question:
Is there a better way to tell OpenResty to update "Content-Type" header according to the file type after proxying?
If not, I assume, "mime.types" file is loaded somewhere into memory.
Is it possible to access it (as a table?) from LUA code directly instead of essentially duplicating its content (in LUA code)?
lua_use_default_type setting for the location has no effect and is right behavior, apparently.
Not sure if it’s related to 1449
Thanks!
I didn’t provide config example, I it’s not needed for this case.
[root@nginx ~]# /usr/local/openresty/nginx/sbin/nginx -V
nginx version: openresty/1.13.6.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.1.0h 27 Mar 2018
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.13 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.5 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-dtrace-probes --with-stream --with-stream_ssl_module --with-http_ssl_module