Skip to content

Handle redirection to login page if session has expired when websocket connection is attempted#2078

Open
colinl wants to merge 3 commits intoFlowFuse:mainfrom
colinl:2074_check_for_redirect_before_socket_connection
Open

Handle redirection to login page if session has expired when websocket connection is attempted#2078
colinl wants to merge 3 commits intoFlowFuse:mainfrom
colinl:2074_check_for_redirect_before_socket_connection

Conversation

@colinl
Copy link
Copy Markdown
Collaborator

@colinl colinl commented Mar 25, 2026

Perform an http(s) pre-fetch before websocket connection in order to detect that login is required

Description

Before an attempt is made to open the websocket connection, an attempt is made to http(s) fetch '_setup'. That is a small json file.
If there is a network error then flow drops through to the existing retry strategy.
If the fetch successfully fetches the file then it is ok to make the connection.
If the content is not of type json then the domain is accessible, but there is an issue of some sort, such as the server wants to redirect to a login page, or has served the login page directly. In that case the code forces a page reload, which will take the user to the login page.

Related Issue(s)

Closes #2074

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@colinl
Copy link
Copy Markdown
Collaborator Author

colinl commented Mar 25, 2026

This is working well for me on a PC and on Android, using Cloudflare Zero Trust and google as the authenticator. I can't test it on anything else though. I don't know what we can do to check it on other systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hang with Connection Lost message when using authentication proxy and session times out whilst page is inactive

1 participant