Skip to content

Configuration Options

The Astro Maintenance integration is highly customizable with many options to tailor the maintenance page to your needs. This guide covers all available configuration parameters.

When adding the integration to your Astro config file, you can specify various options:

astro.config.mjs
import { defineConfig } from "astro/config";
import maintenance from "astro-maintenance";
export default defineConfig({
integrations: [
maintenance({
// Your configuration options go here
enabled: true,
template: "simple",
title: "Custom Maintenance Title",
// ...other options
}),
],
});

Here’s a complete reference of all the configuration options available:

PropertyTypeDescriptionRequired
enabledbooleanEnable or disable maintenance mode (default: true)-
template'simple' | 'countdown' | 'construction' | stringBuilt-in template, path to custom template, or route path-
titlestringPage title (default: 'Site under maintenance')-
descriptionstringDescription text-
logostringURL to your logo image. Must reside in the assets or logo subfolder of the public folder-
emailAddressstringContact email address-
emailTextstringText to display before the email address (default: 'Contact us:')-
copyrightstringCopyright text-
countdownstringISO date string for countdown timer in UTC (e.g., '2025-12-31T23:59:59')-
overridestringQuery parameter to bypass maintenance mode (e.g., 'preview')-
allowedPathsstring[]Paths that bypass maintenance mode-
cookieNamestringOverride cookie name-
cookieMaxAgenumberCookie expiration in seconds-
socialsobjectSocial media links configuration for display on maintenance pages-

Controls whether maintenance mode is active. Set to true to activate maintenance mode and display the maintenance page, or false to show your regular site.

maintenance({
enabled: true, // Maintenance mode is active
});

This is useful for toggling maintenance mode without removing the integration.

Specifies which template to use for the maintenance page. You have several options:

  • Built-in templates: 'simple', 'countdown', or 'construction'
  • Path to a custom Handlebars template (e.g., './templates/custom.hbs')
  • Route path in your Astro site (e.g., '/custom-maintenance')
maintenance({
template: "countdown", // Use the built-in countdown template
});

These options control the main heading and description text on the maintenance page:

maintenance({
title: "We'll be back soon!",
description: "Our website is currently undergoing scheduled maintenance.",
});

URL to your company or website logo:

maintenance({
logo: "/logo.png", // Must be in your public folder
});

The logo should be placed in your project’s public folder.

Contact Information (emailAddress and emailText)

Section titled “Contact Information (emailAddress and emailText)”

Add contact information for visitors during maintenance:

maintenance({
emailAddress: "[email protected]",
emailText: "Need assistance? Contact us at:",
});

Add copyright information to the footer:

maintenance({
copyright: "© 2025 Your Company",
});

For the countdown template, specify when maintenance will end using an ISO date string in UTC timezone:

maintenance({
countdown: "2025-06-01T12:00:00Z", // Note the 'Z' for UTC timezone
});

When the countdown reaches zero, maintenance mode will automatically disable itself and visitors will see your actual site.

Specify paths that should bypass maintenance mode entirely. This is useful for allowing access to specific pages or API endpoints during maintenance:

maintenance({
enabled: true,
allowedPaths: [
'/api/health', // Health check endpoint
'/status', // Status page
'/admin', // Admin area
'/api/webhooks/*', // Wildcard support
],
});

Visitors accessing these paths will see your normal site content instead of the maintenance page, even when maintenance mode is enabled.

Control the override cookie settings:

maintenance({
override: "preview",
cookieName: "my_maintenance_bypass", // Default: "astro_maintenance_override"
cookieMaxAge: 86400, // 24 hours (default: 604800 - 7 days)
});

The cookie is set when users access the site with the override parameter and allows them to continue browsing without needing to use the parameter again.

Add social media links to your maintenance page with the socials option. This displays a set of social icons with links to your profiles:

maintenance({
socials: {
x: "https://x.com/yourusername",
github: "https://github.com/yourusername",
linkedin: "https://linkedin.com/in/yourusername",
instagram: "https://instagram.com/yourusername",
facebook: "https://facebook.com/yourusername",
youtube: "https://youtube.com/c/yourusername",
mastodon: "https://mastodon.social/@yourusername",
pinterest: "https://pinterest.com/yourusername",
tiktok: "https://tiktok.com/@yourusername",
discord: "https://discord.com/users/yourusername",
slack: "https://slack.com/yourusername",
twitch: "https://twitch.tv/yourusername",
reddit: "https://reddit.com/user/yourusername",
},
});

All social properties are optional - only the ones you specify will be displayed. The following social platforms are supported:

  • twitter - Twitter/X profile
  • github - GitHub profile or repository
  • linkedin - LinkedIn profile or company page
  • instagram - Instagram profile
  • facebook - Facebook profile or page
  • youtube - YouTube channel
  • mastodon - Mastodon profile
  • pinterest - Pinterest profile
  • tiktok - TikTok profile
  • discord - Discord profile
  • slack - Slack profile
  • twitch - Twitch profile
  • reddit - Reddit profile

All templates automatically display social links in a visually appealing way and support dark mode for better user experience.

This parameter lets you specify a query parameter to bypass the maintenance page:

maintenance({
override: "preview", // Access the site using ?preview in the URL
});

Visitors can access the actual site by adding the parameter to the URL: https://example.com/?preview

These options control the cookie that’s set when using the override parameter:

maintenance({
cookieName: "my_maintenance_override", // Default: "astro_maintenance_override"
cookieMaxAge: 3600, // Cookie expiration in seconds (default: 604800 - 7 days)
});

All configuration options can also be set using environment variables. This is useful for changing settings in different environments (development, staging, production) without rebuilding your application.

Environment variables take precedence over programmatically defined settings, allowing you to easily modify behavior in containerized deployments or CI/CD pipelines.

Environment VariableTypeDescription
MAINTENANCE_ENABLEDbooleanEnable or disable maintenance mode
MAINTENANCE_TEMPLATEstringTemplate to use
MAINTENANCE_TITLEstringPage title
MAINTENANCE_DESCRIPTIONstringDescription text
MAINTENANCE_LOGOstringURL to your logo image
MAINTENANCE_EMAIL_ADDRESSstringContact email address
MAINTENANCE_EMAIL_TEXTstringText to display before the email address
MAINTENANCE_COPYRIGHTstringCopyright text
MAINTENANCE_COUNTDOWNstringISO date string for countdown timer
MAINTENANCE_OVERRIDEstringQuery parameter to bypass maintenance mode
MAINTENANCE_ALLOWED_PATHSstringComma-separated list of paths to bypass maintenance
MAINTENANCE_COOKIE_NAMEstringOverride cookie name
MAINTENANCE_COOKIE_MAX_AGEnumberMax age of the override cookie in seconds
MAINTENANCE_SOCIALSobjectSocial media links (JSON string in env variable)
Terminal window
# Enable maintenance mode with a countdown
MAINTENANCE_ENABLED=true
MAINTENANCE_TEMPLATE="countdown"
MAINTENANCE_TITLE="We're launching soon!"
MAINTENANCE_COUNTDOWN="2025-12-31T23:59:59"
MAINTENANCE_ALLOWED_PATHS="/api/health,/status,/admin"
MAINTENANCE_OVERRIDE="secure-preview-key"

This approach is particularly useful for:

  • Toggling maintenance mode in production without code changes
  • Setting different configurations across environments
  • Deploying containerized applications where rebuilding is costly
  • Managing feature flags in CI/CD pipelines

This is useful for previewing your actual site during maintenance or for letting specific users (like team members) bypass the maintenance page.


Security Tip For security reasons, avoid using a simple or guessable override key like "preview". Instead, use a long, randomly generated, URI-safe string (e.g., "bypass-43uhksdf82jd82") to reduce the risk of unintended access.


You can use this command in your terminal to generate a safe random key:

Terminal window
node -e "console.log('bypass-' + require('crypto').randomBytes(12).toString('base64url'))"

Example output:

bypass-jK8dL2t3Y_mkNCxQ9r4Ctg

Use this value as your override parameter:

maintenance({
// ... other options
override: "bypass-jK8dL2t3Y_mkNCxQ9r4Ctg",
});

Now you can access your site like this:

http://localhost:3000/?bypass-jK8dL2t3Y_mkNCxQ9r4Ctg

When using the countdown template, keep in mind:

  1. The countdown displays time in UTC timezone
  2. After the countdown ends, maintenance mode automatically disables
  3. If there’s a time mismatch, the page will attempt to reload every 10 seconds
  4. Format the date as an ISO string with the ‘Z’ suffix to ensure UTC timezone

Now that you understand all configuration options, check out our templates: