Repository navigation
Replies: 1 comment
|
Those three exact values ( In
Response.Headers.CacheControl = "no-cache,no-store";
Response.Headers.Pragma = "no-cache";
Response.Headers.Expires = "Thu, 01 Jan 1970 00:00:00 GMT";
That would also explain why it only happens through Traefik: when you hit the gateway directly (presumably over plain HTTP inside the cluster), the browser doesn't send the auth cookie (or the user isn't signed in on that host), so there's nothing to renew. Through Traefik on HTTPS the cookie is present, so the renewal kicks in. If you see If something in your setup sets Fix: don't renew the cookie on static asset requests. In the gateway's cookie options: .AddCookie(options =>
{
options.Events.OnCheckSlidingExpiration = ctx =>
{
if (IsStaticAsset(ctx.Request.Path))
ctx.ShouldRenew = false;
return Task.CompletedTask;
};
});
static bool IsStaticAsset(PathString path) =>
path.Value is { } p && (p.Contains("/_framework/") || p.EndsWith(".wasm") || p.EndsWith(".js") || p.EndsWith(".css"));If you renew from Trying to re-apply your headers in another |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I have an app running on K8S, that terminates the TLS at Traefik and then forwards all traffic to an ASP.Net core WebAPI running YARP.
YARP then takes care of all the routing, claims transformation, etc. It's acting like a Gateway.
One of our downstream services is a Blazor app. It's running .Net 10.0.10 and InteractiveAuto render mode. It lives under the /interactive-auto path.
The website works but switching over to WASM is slow because the _framework files are downloaded on each page refresh.
They are never served from disk and always have a 200 OK response code.
The browser never caches chaces the WASM _framework file, because there are three headers always set in the response:
To attempt to fix the issue, I created a ResponseTransform:
When I bypass Traefik, the headers are set properly by YARP.
When I bypass YARP and go through Traefik only, the headers are set properly by the Blazor app middleware itself.
But, when YARP is sitting behind Traefik, the headers are overriden.
I even added a custom header to the WasmCacheResponseTransform above to test if it persists, and it does.
The ASP.Net core app running YARP has the forwarded headers middleware configured:
There is no Traefik middleware doing any kind of cache header settings.
There seems to be some kind of an issue with proxy to proxy interplay.
Any ideas, please? Thanks.
All reactions