You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "david187 (via GitHub)" <gi...@apache.org> on 2023/04/11 07:46:43 UTC

[GitHub] [trafficserver] david187 opened a new issue, #9596: "Cache-Control" header and "Age" header are removed by ESI module

david187 opened a new issue, #9596:
URL: https://github.com/apache/trafficserver/issues/9596

   ### Reproduction
   
   Master Document Header:
   X-Esi: 1
   etag: W/"xxxxx"
   content-type: text/html; charset=UTF-8
   Cache-Control: max-age=30
   
   ESI sub-document 1 header:
   cache-control: public, max-age=30
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   
   ESI sub-document 2 header:
   cache-control: public, max-age=30
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   
   ### Final Output header:
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   X-Cache-Status: UPDATED
   
   request after 10s
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   X-Cache-Status: HIT
   
   so, the caching seem work internally. but the headers are removed.
   ====
   The "Cache-Control" header and "Age" header are removed by ESI module
   
   ### Expected Results
   Final Output header:
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   cache-control: public, max-age=30
   Age: 0
   
   and, if request after 10s
   
   content-type: text/html; charset=UTF-8
   etag: W/"XXXXXX"
   cache-control: public, max-age=30
   Age: 10
   
   
   The cahe control / Age header should be keep to let upper layer / client cache work.
   
   Here are some code about the max-age header calculation, need addition config to make it take effect ?
   https://github.com/apache/trafficserver/blob/0e9ff8271811a46b46825fe22a272347b64df078/plugins/esi/combo_handler.cc#L266
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] shukitchan commented on issue #9596: "Cache-Control" header and "Age" header are removed by ESI module

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-1503516525

   Yes. the cache control header is removed - https://github.com/apache/trafficserver/blob/master/plugins/esi/esi.cc#L1111
   
   We can either add an option to stop it from happening. 
   Or you can use header_rewrite / lua plugin to add the cache control header back at the "send response header" hook. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] "Cache-Control" header and "Age" header are removed by ESI module [trafficserver]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-2073840530

   This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] david187 commented on issue #9596: "Cache-Control" header and "Age" header are removed by ESI module

Posted by "david187 (via GitHub)" <gi...@apache.org>.
david187 commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-1504829629

   The reason of remove these headers is?
   
   I can access and copy the "Cache-Control" header as "X-Cache-Control" during TS_LUA_HOOK_READ_RESPONSE_HDR hook.
   However, if i restore the "X-Cache-Control" as "Cache-Control" during TS_LUA_HOOK_SEND_RESPONSE_HDR. it will be removed. ( Although I can restore at the upper layer) 
   
   However, the age header seem can not access by ts.cached_response.header / ts.server_response.header in lua plugin. I think it is useful for multiple layer caching.
   
   Temporarily, I am trying to add a timestamp header to calculate the age.
   
   ===
   > We can either add an option to stop it from happening.
   can add a new options at next version?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] shukitchan commented on issue #9596: "Cache-Control" header and "Age" header are removed by ESI module

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-1506007541

   I can't quite remember why we did that in the first place. Perhaps we want to later add a private cache control header. 
   
   ESI plugin added a transaction hook to remove these headers - https://github.com/apache/trafficserver/blob/master/plugins/esi/esi.cc#L1426
   
   So if you use lua, you need to have the lua plugin after ESI plugin and also adds a transaction hook for TS_LUA_HOOK_SEND_RESPONSE_HDR at the do_global_send_response() function 
   
   Lua is not aware of ESI at all so there is no way to retrieve the sub document headers. 
   
   We can add a new options at next version or any contributions are welcome as well. 
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] david187 commented on issue #9596: "Cache-Control" header and "Age" header are removed by ESI module

Posted by "david187 (via GitHub)" <gi...@apache.org>.
david187 commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-1506231474

   Is it possible to keep specify sub-document headers( such as etag, cache-control, last-modified ) somewhere.
   
   or combo the specify headers as:
   X-ESI-Etags: <master document etag>, <sub-document etag 1>, <sub-document etag 2>...
   X-ESI-Last-Modified: <the lastest last-modified value of master and sub-documents >
   X-ESI-Cache-Control: <public | private>, max-age=<the smallest max-age value of master and sub-documents>
   
   https://github.com/apache/trafficserver/blob/0e9ff8271811a46b46825fe22a272347b64df078/plugins/esi/combo_handler.cc#L266
   
    It will be useful for parent / multiple layer caching.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] shukitchan commented on issue #9596: "Cache-Control" header and "Age" header are removed by ESI module

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on issue #9596:
URL: https://github.com/apache/trafficserver/issues/9596#issuecomment-1507916607

   Theoretically yes. The changes will be quite a lot, though. 
   
   Alternatively, lua plugin has a fetch function that returns the headers of the fetch URL - https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html#ts-fetch
   
   Of course the downside of it is that you need to implement the ESI-like content replacement on your own inside the lua script as well. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org