Testing quarantine and CSP before launch
Overview
Section titled “Overview”Before launching your production website with Appwarden protection, it’s critical to verify that both quarantine functionality and, optionally, Content Security Policy (CSP) configuration work correctly. This guide walks you through end-to-end testing to ensure your infrastructure is properly configured and ready to protect your users.
Testing before launch helps you:
- Confirm middleware deployment: Verify the middleware is running and communicating with Appwarden
- Validate quarantine functionality: Test that you can lock and unlock your domain from Discord or Slack
- Refine your CSP: Safely test Content Security Policy in report-only mode before enforcement
- Catch configuration errors: Identify and fix issues before they impact production users
Prerequisites
Section titled “Prerequisites”Before testing, ensure you’ve completed the following setup steps:
- Onboard your organization: Complete the onboarding guide to connect your Discord server or Slack workspace, GitHub, and create your domain configuration repository
- Deploy the middleware: Follow the project integration guide for your platform (Vercel or Cloudflare) to install and deploy the Appwarden middleware
Once these prerequisites are met, you’re ready to begin testing.
Step 1: Verify middleware deployment
Section titled “Step 1: Verify middleware deployment”The first step is confirming your middleware was successfully deployed and is running on your domain.
debug: true in your middleware options and redeploy.Check provider deployment logs
Section titled “Check provider deployment logs”Verify the deployment succeeded by checking your provider’s logs:
For Vercel deployments:
- Navigate to your project in the Vercel dashboard
- Go to the Deployments tab
- Click on your most recent deployment
- Review the deployment logs for successful completion
- Look for any errors related to middleware installation
For Cloudflare deployments using GitHub Actions:
- Navigate to your domain configuration repository on GitHub
- Go to the Actions tab
- Find your most recent Deploy Appwarden workflow run
- Click on the workflow run to view details
- Review the deployment logs for successful completion
- Confirm the worker was deployed to Cloudflare

Verify middleware configuration
Section titled “Verify middleware configuration”Next, inspect your application logs to confirm the middleware is running correctly and communicating with Appwarden.
For Vercel deployments:
- Navigate to your project in the Vercel dashboard
- Go to the Logs tab (under your project settings)
- Filter logs to show real-time activity
- Visit your website to trigger a request
- Look for Appwarden middleware log entries indicating successful heartbeats
For Cloudflare standalone middleware:
Use the Cloudflare Workers CLI to tail logs from your deployed worker:
wrangler tail appwarden-productionVisit your website to trigger requests and observe the middleware logs. You should see log entries for:
- Successful API heartbeats to Appwarden
- Middleware initialization
- Request processing
For Cloudflare framework adapters:
If using a framework-specific adapter (Astro, React Router, TanStack Start, Next.js), tail your application’s worker logs:
wrangler tail <your-project-name>Visit your website and look for Appwarden-related log entries confirming the middleware is active.
If you don’t see any Appwarden logs, verify your API token is correctly configured in your environment variables and that the middleware is properly installed.
Step 2: Test quarantine functionality
Section titled “Step 2: Test quarantine functionality”Once you’ve confirmed the middleware is deployed and running, test the quarantine functionality using Discord or Slack commands.
Lock your domain
Section titled “Lock your domain”From your Discord server or Slack channel, lock your domain:
/quarantine lockAfter selecting your domain, Appwarden will quarantine it. All users will be redirected to your configured lock page.

Verify the lock page appears
Section titled “Verify the lock page appears”Navigate to your domain in your browser. You should be redirected to your configured lock page (e.g., /maintenance).

Check middleware logs during the test
Section titled “Check middleware logs during the test”While your domain is quarantined, monitor your middleware logs:
For Vercel: Check the Vercel logs for quarantine-related entries
For Cloudflare:
Keep wrangler tail running and observe the logs when you access your domain
You should see log entries indicating:
- The middleware detected the quarantine status
- Requests were redirected to the lock page
- No errors occurred during the redirect
Unlock your domain
Section titled “Unlock your domain”Once you’ve confirmed the lock page redirects correctly, unlock your domain:
/quarantine unlockIf the lock page doesn’t redirect correctly, refer to the lock page setup troubleshooting guide for common issues and solutions.
Step 3: Deploy and refine your Content Security Policy
Section titled “Step 3: Deploy and refine your Content Security Policy”CSP features are only available for projects deployed on Cloudflare. Due to platform limitations, CSP is not supported on Vercel.
Content Security Policy is a powerful security feature that protects against code injection attacks. However, misconfigured CSP can break your website. Testing in report-only mode lets you safely validate your policy before enforcement.
Deploy CSP in report-only mode
Section titled “Deploy CSP in report-only mode”In your domain configuration file, set your CSP to report-only mode:
hostname: your.appversion: 1services: middleware: - url: your.app options: lock-page-slug: /maintenance csp-mode: report-only csp-directives: script-src: - "self" - "{{nonce}}" style-src: - "self" - "{{nonce}}" # Add other directives as neededCommit and push your changes, then redeploy your Appwarden middleware following the deployment instructions.
Monitor CSP violations in browser DevTools
Section titled “Monitor CSP violations in browser DevTools”With report-only mode enabled, your CSP won’t block any resources—it will only report violations. Use your browser’s Developer Tools to identify violations:
- Open your website in a browser
- Open Developer Tools (F12 or right-click → Inspect)
- Navigate to the Console tab
- Look for CSP violation warnings (they’ll be clearly marked)
Example CSP violation message:
[Report Only] Refused to load the script 'https://example.com/script.js'because it violates the following Content Security Policy directive:"script-src 'self' 'nonce-abc123'".Refine your CSP directives
Section titled “Refine your CSP directives”Based on the violations you see in the console:
- Identify legitimate resources: Determine which violations are from your own resources vs. third-party services
- Update your CSP directives: Add necessary domains to your CSP configuration
- Test iteratively: Redeploy with updated directives and retest until violations are resolved
Example of adding a third-party domain:
csp-directives: script-src: - "self" - "{{nonce}}" - "https://cdn.example.com" # Add legitimate third-party domainsEnforce your CSP
Section titled “Enforce your CSP”Once you’ve resolved all CSP violations and confirmed your website works correctly in report-only mode, switch to enforced mode:
csp-mode: enforcedRedeploy your middleware and verify that:
- Your website functions correctly
- No console errors appear
- All legitimate resources load successfully
Learn more about managing your Content Security Policy in the CSP management guide.
Next steps
Section titled “Next steps”After completing these tests, you’re ready to go live with Appwarden protection:
- Monitor your domain: Keep an eye on the Appwarden dashboard for any incidents
- Configure team alerts: Set up PagerDuty integration to notify your team during incidents
- Review incident procedures: Familiarize your team with incident management workflows
- Test full quarantine: Consider running a planned
/quarantine locktest during off-hours to ensure your team is prepared for an emergency
Questions about testing or running into issues? Join our community and we’ll help you get set up.
