NCI-Semantic-Infrastructure / shared-si-issues

Umbrella repo for Shared SI Service issues
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

do not cache queries #8

Open fragosog opened 1 year ago

fragosog commented 1 year ago

Noticed in the ASK query when it was being enabled in the modsec rules. Need to add something like this to apache configuration

<Location /sparql >
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache" 
</Location>

PS Maybe the page should be not-cached rather than the endpoint. The query doesn't run in a naive browser, so probably the error page is what's getting cached.

fragosog commented 1 year ago

Wound up with

<LocationMatch "^(/|/index\.html)$" >
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache" 
</LocationMatch>

per above PS.

pawankukreja01 commented 10 months ago

To configure Cache-Control headers in your Apache server, you can use the following directives:

<Location /sparql> Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" </Location>

This snippet ensures that the /sparql location is not cached by browsers or CDNs. The max-age=0 directive prevents caching, and no-cache ensures that the content is always revalidated. Additionally, you might consider applying similar settings to specific files or directories as needed

fragosog commented 10 months ago

Thanks, but it turns out it's not the endpoint or the page. The caching is being done by a javascript widget in the page. Yet to be fixed . . .

gilaim07 commented 7 months ago

OK, can't test in the servers, but I think this fixes the caching in the resultset section. In the index.content file in si-web/html, below the line

(yasgui.getTab()).setQuery("select distinct ?graph where { graph ?graph { ?s ?p ?o } } limit 100");

added:

yasgui.getTab().yasr.options , {
    requestConfig: {
        persistencyExpire: 0,
}};

it's in git tag 1.1.0. Please update the git repo in the dev server and test it with good and bad queries for several days before putting in a deployment request for the upper tiers. Feel free to ping for the build details.