Skip to content

Control how long web forms stay valid

Every form on the EDH web interface (launching a virtual desktop, submitting a job, editing a setting, and so on) carries a security token. The token proves the request comes from your own browser session, and protects your users against cross-site request forgery (CSRF) attacks.

Default behavior

By default, the token stays valid for as long as the user's session. A user can leave a page open for hours and still submit the form, without seeing the "your session has expired, please refresh and try again" message.

This is the recommended setting. The token is always tied to the user's session, so it never stays valid after the session ends.

Set a fixed expiry

If your security policy requires forms to expire after a fixed time, even while the session is still active, run these commands as root on the EDH controller. This example sets a 4-hour limit:

source /etc/environment
EDHCTL="/opt/edh/$EDH_CLUSTER_ID/cluster_manager/edhctl"

# Stop the token from following the session
$EDHCTL config set --key /configuration/WebInterface/csrf_token_follows_session --value false

# Token lifetime in seconds (must be 1 or more)
$EDHCTL config set --key /configuration/WebInterface/csrf_token_lifetime_seconds --value 14400

# Restart the web interface to apply the change
/opt/edh/$EDH_CLUSTER_ID/cluster_manager/web_interface/edhwebui.sh restart

Users who submit a form older than this limit see the "your session has expired" message and must refresh the page.

Setting Default What it does
csrf_token_follows_session true true: the token is valid for the whole session. false: the token expires after csrf_token_lifetime_seconds.
csrf_token_lifetime_seconds 3600 (1 hour) Token lifetime, in seconds. Only used when csrf_token_follows_session is false. An invalid value falls back to 1 hour.

Set it at installation

You can also choose these values before you install EDH, under Config.web_interface in default_config.yml.

To return to the default behavior, set csrf_token_follows_session back to true and restart the web interface.