Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types setting not working #21

Open
gumpjt opened this issue Jun 3, 2017 · 5 comments
Open

types setting not working #21

gumpjt opened this issue Jun 3, 2017 · 5 comments

Comments

@gumpjt
Copy link

gumpjt commented Jun 3, 2017

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.

@agentzh
Copy link
Member

agentzh commented Jun 3, 2017

@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!

@gumpjt
Copy link
Author

gumpjt commented Jun 4, 2017

@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.

@agentzh
Copy link
Member

agentzh commented Jun 4, 2017

@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

@gumpjt
Copy link
Author

gumpjt commented Jun 5, 2017

@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?

@agentzh
Copy link
Member

agentzh commented Jun 5, 2017

@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!

agentzh pushed a commit that referenced this issue Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants