Web Framework Integrations
Anubis works as a reverse proxy in front of your application. This guide covers framework-specific configurations to ensure smooth integration.WordPress
WordPress is the most popular blog engine on the planet.Multi-site Setup with TLS Termination
If you have a multi-site setup where traffic goes through Anubis like this: WordPress may not realize that the underlying connection is being done over HTTPS. This could lead to a redirect loop in the/wp-admin/ routes.
Solution: Add the following to your wp-config.php file:
HTMX
HTMX is a framework that enables you to write applications using hypertext as the engine of application state. This enables you to simplify your server side code by having it return HTML instead of JSON. This can interfere with Anubis because Anubis challenge pages also return HTML.Allow HTMX Requests After Challenge
To work around this, you can make a custom [expressionexpression rule that allows HTMX requests if the user has passed a challenge in the past:- Checks that the request has cookies
- Verifies the
anubis-authcookie is present - Confirms this is an HTMX request via the
Hx-Requestheader - Allows the request to pass through
This will reduce some security because it does not assert the validity of the Anubis auth cookie, however in trade it improves the experience for existing users.
General Integration Tips
Setting the Target
Configure Anubis to proxy to your backend application:Custom Headers
If your framework needs specific headers, use the target host configuration:Base Prefix
If your application is served under a subpath:Cookie Domain
For multi-domain setups:Framework-Specific Challenges
Single Page Applications (SPAs)
For React, Vue, Angular, etc.:- Ensure your SPA can handle the initial challenge page
- Consider using the
og-passthroughfeature for better social sharing - Configure proper redirect domains
API-First Applications
For applications that primarily serve JSON:- Use the
/api/checkendpoint for auth validation - Configure policies to ALLOW authenticated API requests
- Consider using JWT restriction headers for additional security
Server-Side Rendered Applications
For Next.js, Nuxt, SvelteKit, etc.:- These typically work out of the box
- Ensure cookies are properly forwarded
- Test your build process with Anubis in front
Troubleshooting
Redirect Loops
If you’re experiencing redirect loops:- Check
X-Forwarded-Protoheader handling - Verify
COOKIE_SECUREmatches your TLS setup - Review
COOKIE_SAME_SITEconfiguration
CORS Issues
If CORS is blocking requests:- Ensure your backend CORS settings allow the Anubis cookie
- Check that
COOKIE_SAME_SITEis appropriate for your setup - Verify
REDIRECT_DOMAINSincludes all necessary origins
Session Management
If sessions aren’t persisting:- Configure
COOKIE_EXPIRATION_TIMEappropriately - Ensure
ED25519_PRIVATE_KEY_HEXis set for persistence - Verify your store backend is properly configured