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

Browser Caching Swagger Page "Get" Requests at Standard Text Endpoint #836

Open
msweier opened this issue Aug 9, 2024 · 8 comments
Open
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson enhancement New feature or request priority:medium We care, and will try and get to it soon.

Comments

@msweier
Copy link

msweier commented Aug 9, 2024

I noticed Chrome was caching my Swagger page "Get" request when I was playing around GET/POST/DELETE with the Standard Text end point. After a POST or DELETE the GET request on the Swagger page wouldn't reflect the change. Not sure if anything can be done, but something to be aware of.

@krowvin
Copy link
Collaborator

krowvin commented Aug 19, 2024

Not sure if anything can be done

CDA sets the header for Cache-Control to 300 seconds or roughly 5 minutes.

In Swagger if you want to do your testing there you can (on your end) click the box to "disable cache" in the dev tools.
image

As for client applications that are either native, web based, or otherwise. You could manually decide if you want to cache or re-request.

As just an example for web that would look like this (For VanillaJS)

fetch("cda/ts/url", { cache: "no-store" }).then((response) => {
  /* consume the response */
});

Via
https://developer.mozilla.org/en-US/docs/Web/API/Request/cache#examples

But good point this is something to be aware of, and i'm not sure this is listed anywhere so thought i'd mention the above!

@msweier
Copy link
Author

msweier commented Aug 19, 2024

It's odd that CLOB end point doesn't seem to have this issue.

@krowvin
Copy link
Collaborator

krowvin commented Aug 19, 2024

Good chance the clob doesn't have the cache headers set

I just assumed all were by default set to 5

@MikeNeilson any ideas on which endpoints might have this?

@MikeNeilson
Copy link
Contributor

Should be most of them. Which 99% of the time is the right thing to to do. This is clearly in that 1%. That said I think the full and proper solution is going to use etags and the database informing the API there's a new version.

@MikeNeilson MikeNeilson added enhancement New feature or request priority:medium We care, and will try and get to it soon. approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson labels Aug 20, 2024
@MikeNeilson
Copy link
Contributor

A simple solution can just be to add a random, but unused parameter to the parameters, but that only works outside of swagger.

@rma-rripken
Copy link
Collaborator

@msweier How are you using the Clob endpoint? Are you requesting as text/plain? The Clob controller should have the same caching headers set but text/plain is being handled in a special way for clob so that large clob (gigabytes?) can be streamed directly from database and the clob end-point also supports range-requests. It wouldn't surprise me if browser or libraries are making requests against clob in ways that aren't going to benefit from normal cache-control headers.

@msweier
Copy link
Author

msweier commented Oct 3, 2024

@msweier How are you using the Clob endpoint? Are you requesting as text/plain?

I was just using the CLOB endpoint to view the standard text w/ the Swagger docs. Just testing.

@krowvin
Copy link
Collaborator

krowvin commented Oct 3, 2024

@tsressin you might be interested in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-W192HQ23F0232-task4 Only valid if set by MikeNeilson enhancement New feature or request priority:medium We care, and will try and get to it soon.
Projects
None yet
Development

No branches or pull requests

4 participants