You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a situation where someone has a custom Java library that intercepts the response from a subgraph before it goes out to the router and inserts a cache-control header into that response.
The problem is:
With entity caching enabled it seems that it allows subgraphs to insert additional directives programmatically, but the router does not filter out unnecessary values, which is a confusing experience for clients.
The router does disallow invalid values and there does seem to be some logic to validate the directives present (ex. when passing no-cache it changes it in the final response to no_cache)
I've also created a graph in Studio. I didn't want to expose the API key so please feel free to reach out if you want to avoid creating your own graph. Since this is an enterprise feature a graph ref and API key will be needed.
Start the subgraph, the cache and the router and send a request! I've added a screenshot of what you should see in the headers.
Expected behavior
The expected behaviour is that the router will filter out unnecessary values from the cache-control header when the request resolves. So if there's max-age=10, no-cache, must-revalidate, no-store, the expected value for the cache-control header would simply be no-store. Please see the MDN docs for justification of this reasoning: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#preventing_storing
Output
Desktop (please complete the following information):
OS: [e.g. iOS] MacOS
Version [e.g. 22] Sonoma 14.7
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
I encountered a situation where someone has a custom Java library that intercepts the response from a subgraph before it goes out to the router and inserts a cache-control header into that response.
The problem is:
The router does disallow invalid values and there does seem to be some logic to validate the directives present (ex. when passing
no-cache
it changes it in the final response tono_cache
)To Reproduce
Expected behavior
The expected behaviour is that the router will filter out unnecessary values from the
cache-control
header when the request resolves. So if there'smax-age=10, no-cache, must-revalidate, no-store
, the expected value for thecache-control
header would simply beno-store
. Please see the MDN docs for justification of this reasoning: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#preventing_storingOutput
Desktop (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: