Jump to content

ICT:Timeout issues

From Costa Sano MediaWiki
Revision as of 11:32, 9 February 2026 by Mngr (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Administrator Procedures: Extending Session Timeouts

As a Sysop, you can adjust the server configuration to better support long-term historical research. These changes must be made in the LocalSettings.php file on the server.

1. Increasing the Idle Session Window

By default, MediaWiki ends a session after 1 hour of inactivity. For researchers who spend hours drafting, this should be increased to 24 hours.

Add or update this line:

$wgObjectCacheSessionExpiry = 86400; // Time in seconds (24 hours)

2. Ensuring Persistent Logins

To prevent users from being logged out when they close their browser, ensure the cookie expiration is set to a long duration (default is 30 days).

$wgCookieExpiration = 2592000; // 30 days

3. Forcing "Keep Me Logged In" by Default

To protect users who forget to check the "Keep me logged in" box, you can force it to be checked by default using this hook:

$wgHooks['AuthChangeFormFields'][] = function ( $requests, $fieldInfo, &$formDescriptor, $action ) {
    if ( isset( $formDescriptor['rememberMe'] ) ) {
        $formDescriptor['rememberMe']['default'] = true;
    }
    return true;
};

4. PHP-Level Configuration (Server Admin)

If users are still being logged out prematurely, the underlying PHP configuration may be cleaning up sessions too early. Ensure your php.ini or LocalSettings matches the MediaWiki timeout:

ini_set( 'session.gc_maxlifetime', 86400 );

5. Verifying Edit Recovery

Ensure the built-in auto-save feature is active. In MediaWiki 1.43, this is on by default, but it can be explicitly set:

$wgEnableEditRecovery = true;

Note: After changing LocalSettings.php, no restart is usually required, but users may need to log out and log back in for new session lengths to take effect.

Administrator Procedures: IIS Reverse Proxy Configuration

Since this wiki sits behind an IIS Reverse Proxy (Application Request Routing), the server might cut the connection before the user finishes saving, even if MediaWiki's session is still active.

1. Increasing the Connection Timeout

If a researcher is saving a very large page with many references, IIS may time out. Increase the "Connection Timeout" in the IIS Manager:

  1. Open IIS Manager.
  2. Select the Site for your wiki.
  3. In the Actions pane (right side), click Limits... under "Configure".
  4. Increase Connection timeout (seconds) from 120 to 600 (10 minutes).

2. Adjusting ARR (Application Request Routing) Timeout

The proxy module itself has a separate timeout. This is the most common cause of "502 Gateway Timeout" errors during saves:

  1. In IIS Manager, select the Server level node.
  2. Open Application Request Routing Cache.
  3. Click Server Proxy Settings in the "Actions" pane.
  4. Find Time-out (seconds) and increase it to 600.
  5. Click Apply.

3. Web.config Adjustments

You can also ensure the Request Timeout is handled at the application level by adding/editing the following in your wiki's `web.config` file:

<system.webServer>
  <proxy recvTimeout="00:10:00" sendTimeout="00:10:00" />
</system.webServer>

4. Request Filtering (Large Uploads/Edits)

Historical documents often involve large text blocks. Ensure IIS allows large "POST" requests:

  1. Open Request Filtering in IIS Manager.
  2. Click Edit Feature Settings...
  3. Ensure Maximum allowed content length (Bytes) is high enough (e.g., 30000000 for ~30MB).