-
Notifications
You must be signed in to change notification settings - Fork 598
RC2, seems like CookieAuthenticationOptions.CookieSecure does not work #831
Comments
Please share the response headers. |
Note that some load balancers will give you an x-forwarded-proto header to let you know the original scheme. Or if you know it will always be https you can hardcode it:
|
@Tratcher our response header:
|
That's session and anti-forgery, not CookieAuthentication. Were you intending to use |
Oh sure, you are right! I've checked and that other cookie is set to secure. So what I'm looking for is
But there is no option for CookieSecure on that SessionOptions. Am I asking the right question under right Repro? Since my other question #832 is about how to make |
aspnet/Session#106 |
That said, you should really fix your request scheme rather than focusing on the cookie settings. For example aren't your links automatically generated using |
@Tratcher Thanks. Cookie middleware worked. But as I tested, using that Cookie middleware, works for .AspNetCore,Antiforgery and .AspNetCore.Session but won't work on AuthenticationCookie so I have to set that separately. Don't know if it is a bug or as intended. |
A bug: #814 |
Wow, you guys are super fast, super helpful. I'm getting my life's best tech support ever. Thanks again. Q#2, as for the issue of load balancer you think that small middleware Would fix all these types of issues? I'm going to test it. Does it matter were I put in |
Yes it should help with these issues because many middleware inspect the scheme. Put it at the start so all it affects all requests. Does your load balancer specify x-forwarded-for headers? In that case us the ForwardedHeaders middleware instead. https://github.com/aspnet/BasicMiddleware/blob/dev/samples/HttpOverridesSample/Startup.cs#L13 |
woops, x-forwarded-proto headers... |
@Tratcher good. Not sure they said to use 'X-SSL-SessionId'. I'm going to check that X-Forwarded-Proto Thanks again. |
One last question, any plans to add "same-site" setting on CookiePolicy middleware. I think I can do it now with |
Cookies by default only get sent back to the same domain. Can you clarify what you're asking about? |
@Eilon I'm asking about "same-site cookie attribute" something like |
Ah, this draft? https://tools.ietf.org/html/draft-west-first-party-cookies-07? Maybe when the spec is finished. |
Thanks |
In RC2, seems like setting
CookieAuthenticationOptions.CookieSecure = CookieSecureOption.Always;
Does not work anymore. We cannot afford the default value
SameAsRequest
since we are behind a LoadBalancer that opens the SSL packets and sends us via HTTP. In RC1, the same code in our Startup.cs use to take care of it.The text was updated successfully, but these errors were encountered: