This is a repository to investigate alter etag in nginx.
When using nginx as a reverse proxy, and do some response replacement using ngx_http_sub_module. There is an issue that when the replacement rule is changed but the upstream response is not, etag of the response will not be changed, and the browser cannot receive the fresh result with the newer replacement.
- During proxy response, nginx appends a hardcoded proxy etag to
Etag
header field of the upstream response. - During proxy request, nginx will deconstruct the
If-None-Match
header field to upstream etag and proxy etag.- If proxy etag matches the current proxy etag, proxy the
upstream etag as
If-None-Match
header field to upstream. - If proxy etag does not matches the current proxy rtag, do not proxy
the
If-None-Match
header field to upstream.
- If proxy etag matches the current proxy etag, proxy the
upstream etag as
It may be implemented by ngx_http_map_module or some Perl script.
I'll try map directive first. Success
$ docker-compose up --build