types setting not working
Hi there, I add this in my config, but when the response is text/html, it will also replace. Any comments?
replace_filter_types application/x-javascript javascript text/javascript application/javascript;
Thanks.
@gumpjt This indeed looks like a problem in the implementation of the replace_filter_types directive. Will you mind creating a pull request to address this issue? Many thanks!
@agentzh I'm a newbie of C and Nginx. I'm willing to but I think it's out of my hand... 😭 I checked my config and I'm sure there is something wrong there.
@gumpjt One workaround is to use ngx_lua's header_filter_by_lua* to conditionally set a custom nginx variable, say, $skip_replace, and then reference that variable in the replace_filter_skip directive:
https://github.com/openresty/replace-filter-nginx-module#replace_filter_skip
@agentzh Thanks.
I also found this method and I'm struggling about the order of header_filiter_by_lua* and the replace_filter_skip directive. Now I need to make sure that header_filter_by_lua* should run before replace_filter_skip directive.
I'm using openresty, is there any way to change it? If I use pure Nginx, I can make the config options like this:
./configure --add-module=replace_module
--add-module=lua_nginx_module
Then the header_filter will handle first. But how to do it with openresty?
@gumpjt Hmm, seems like we should add a new --prepend-module=PATH option to OpenResty's ./configure script so that the modules can be prepended to OpenResty's own --add-module=PATH options. Will you contribute a patch for this? Thanks!