Skip to content

Websockets proxy with session expiration #2209

Answered by Tratcher
eraffel-MDSol asked this question in Q&A
Discussion options

You must be logged in to vote

Yes. Start with these docs:
https://microsoft.github.io/reverse-proxy/articles/websockets.html
https://microsoft.github.io/reverse-proxy/articles/authn-authz.html

Which kind of auth? You may be able to hook into the auth events to set up the verification polling, or create a middleware for that. If you can determine the expiration up front that's even easier, just set up a timer to call HttpContext.Abort(), and cancel it if the request finishes HttpContext.RegisterForDispose(timer).

Note that if you do decide to close the WS connection due to auth expiration/revocation, there's no easy way to do it gracefully (WebSocket Close message), it will be a connection abort.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by karelz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Type: Idea This issue is a high-level idea for discussion.
2 participants
Converted from issue

This discussion was converted from issue #2208 on August 01, 2023 06:35.