HTTPS Redirect — Aquilia Documentation
Comprehensive guide and documentation for HTTPS Redirect in the Aquilia framework. View API reference, examples, and implementation patterns.
MIDDLEWARE / HTTPS REDIRECT HTTPSRedirectMiddleware The HTTPSRedirectMiddleware intercepts incoming unsecured HTTP requests and redirects them to their equivalent HTTPS addresses. Constructor Configuration Configure redirect responses and host exemptions to facilitate local development and health check pings: redirect_status: int = 301 — HTTP redirect status code (e.g. 301 Moved Permanently or 307 Temporary Redirect). exclude_paths: list[str] | None = None — Paths excluded from redirections. Use this to allow unsecured health checks (e.g. ["/healthz"]). exclude_hosts: list[str] | None = None — Hostnames exempt from redirections (defaults to ["localhost", "127.0.0.1", "0.0.0.0"]). Usage Example from aquilia.middleware_ext import HTTPSRedirectMiddleware from aquilia.workspace import Workspace from aquilia.integrations import MiddlewareChain workspace = Workspace("myapp").middleware( MiddlewareChain().use( "aquilia.middleware_ext.security:HTTPSRedirectMiddleware", priority=8, redirect_status=307, exclude_paths=["/ping"] ) ) Overview )
Go to Homepage