Fix: Allow HTTP for local Supabase connections (#323)

- Modified validate_supabase_url() to allow HTTP for local development
- HTTP is now allowed for localhost, 127.0.0.1, host.docker.internal, and 0.0.0.0
- HTTPS is still required for production/non-local environments
- Fixes server startup failure when using local Supabase with Docker
This commit is contained in:
Thilanga Pitigala 2025-08-19 22:07:25 +10:00 committed by GitHub
parent b5e5cddc68
commit 913cdcd349
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,8 +97,15 @@ def validate_supabase_url(url: str) -> bool:
raise ConfigurationError("Supabase URL cannot be empty")
parsed = urlparse(url)
if parsed.scheme != "https":
raise ConfigurationError("Supabase URL must use HTTPS")
# Allow HTTP for local development (host.docker.internal or localhost)
if parsed.scheme not in ("http", "https"):
raise ConfigurationError("Supabase URL must use HTTP or HTTPS")
# Require HTTPS for production (non-local) URLs
if parsed.scheme == "http":
hostname = parsed.hostname or ""
if not any(local in hostname for local in ["localhost", "127.0.0.1", "host.docker.internal", "0.0.0.0"]):
raise ConfigurationError("Supabase URL must use HTTPS for non-local environments")
if not parsed.netloc:
raise ConfigurationError("Invalid Supabase URL format")