return new HttpResult(responseDto)
{
Cookies = {
new Cookie(name, value, path) {
HttpOnly = true,
Secure = Request.IsSecureConnection,
Expires = DateTime.UtcNow.Add(jwtAuthProvider.ExpireTokensIn),
}
}
};
But you couldn’t change the built-in Cookies for ServiceStack Sessions only if they should be returned by overriding AppHost.AllowSetCookie(). I’ve just added AppHost.SetCookieFilter() in this commit. This change is available from v5.1.1 that’s now available on MyGet.
Edit: Found that! The following line is what is causing my problem. Why is it like that? You don’t have that error because you are using IIS, while I’m using the self-host version.
This is my result:
I’m using a custom CredentialsAuthProvider. Do you have any clue on why only that cookie works like that?
Not sure the logic of a / for session cookies has basically been there since the start and its behavior retained through multiple refactoring. From what I can tell from the earliest source code it was due to SetSessionCookie(name,value) only having 2 arguments to maintain a simple API, so I’m assuming it’s not necessary as the other hosts don’t have this behavior.
I’ve changed it to use cookie.Path if it exists in this commit, this change is available from the latest v5.1.1 that’s now available on MyGet.
It works fine, but the ServerEvents paths seems not to understand the “{ignore}” placeholder. Is it possible to implement the same routing policy of the other paths?
No it’s not possible, it needs to be a single static path. The SSE event-stream is not a Service, it’s a long-running HTTP Handler, they’re used to generate URLs which are sent to the client which use them verbatim.
There can only be a single path, if you want to pass custom params pass them on the queryString.