mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
fix(caching): integrate with axios cache interceptor [EE-6505] (#10922)
* integrate with axios-cache-interceptor * remove extra headers as not needed
This commit is contained in:
parent
d0b9e3a732
commit
0b9cebc685
8 changed files with 123 additions and 55 deletions
|
@ -107,6 +107,7 @@ func kubeOnlyMiddleware(next http.Handler) http.Handler {
|
|||
return
|
||||
}
|
||||
|
||||
rw.Header().Set(portainer.PortainerCacheHeader, "true")
|
||||
next.ServeHTTP(rw, request)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -57,5 +57,11 @@ func (transport *agentTransport) RoundTrip(request *http.Request) (*http.Respons
|
|||
request.Header.Set(portainer.PortainerAgentPublicKeyHeader, transport.signatureService.EncodedPublicKey())
|
||||
request.Header.Set(portainer.PortainerAgentSignatureHeader, signature)
|
||||
|
||||
return transport.baseTransport.RoundTrip(request)
|
||||
response, err := transport.baseTransport.RoundTrip(request)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
response.Header.Set(portainer.PortainerCacheHeader, "true")
|
||||
|
||||
return response, err
|
||||
}
|
||||
|
|
|
@ -1638,6 +1638,8 @@ const (
|
|||
WebSocketKeepAlive = 1 * time.Hour
|
||||
// AuthCookieName is the name of the cookie used to store the JWT token
|
||||
AuthCookieKey = "portainer_api_key"
|
||||
// PortainerCacheHeader is used to enabled FE caching for Kubernetes resources
|
||||
PortainerCacheHeader = "X-Portainer-Cache"
|
||||
)
|
||||
|
||||
// List of supported features
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue