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

how to keep original Last-Modified date #23

Open
cenggel opened this issue Mar 1, 2017 · 2 comments
Open

how to keep original Last-Modified date #23

cenggel opened this issue Mar 1, 2017 · 2 comments

Comments

@cenggel
Copy link

cenggel commented Mar 1, 2017

after apply subs_filter to js file the "Last-Modified" header removed and nginx cache config will not work always return 200 state and js file content.

who to cache subs_filtered static resource?

@oxjtt5i5wm
Copy link

oxjtt5i5wm commented May 29, 2018

This issue is simple. In ngx_http_subs_filter_module.c, line 270, ngx_http_clear_last_modified is called to unconditionally remove Last-Modified header.

if (r == r->main) {
    ngx_http_clear_content_length(r);
    ngx_http_clear_last_modified(r);
}

It is not possible to customize this behavior. While it's trivial to patch it, and pull requests are welcomed for any open source project, it looks like the project is no longer maintained. ngx_http_sub_filter_module in the mainline is NOT the same as this module, it is separately maintained, in line 271, both Last-Modified and ETag is removed.

if (!slcf->last_modified) {
    ngx_http_clear_last_modified(r);
    ngx_http_clear_etag(r);

} else {
    ngx_http_weak_etag(r);
}

You should report the problem to the upstream, fill a feature request for keeping Last-Modified and ETag, instead of reporting bugs here.

You can also use https://github.com/openresty/replace-filter-nginx-module instead, it is well-maintained by a reputable developer, @agentzh.

@AnYiEE
Copy link

AnYiEE commented Jan 25, 2023

You can use this fork: AnYiEE/ngx_http_substitutions_filter_module.

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

3 participants