Skip to main content

Bypass blocked DNS for Supabase using DNS-over-HTTPS

Project description

SupaDNS (Python)

Bypass blocked DNS for Supabase using DNS-over-HTTPS (DoH).

If your ISP blocks *.supabase.co via DNS poisoning, standard Supabase libraries will fail with connection errors. supadns provides a drop-in replacement that detects these failures and transparently routes the connection through DNS-over-HTTPS (Quad9 and Cloudflare) while preserving strict TLS SNI validation.

Install

pip install supadns

Quick Start (with supabase-py)

SupaDNS provides a create_smart_client that acts exactly like the standard create_client, but it injects a custom httpx transport.

from supadns import create_smart_client

# This is a standard supabase.Client instance
supabase = create_smart_client(
    "https://myproject.supabase.co",
    "your-anon-key",
)

# All APIs work transparently: Auth, REST, Storage, Functions
data = supabase.table("todos").select("*").execute()
print(data)

Using with standard httpx

If you are just making raw HTTP requests to Supabase, you can use the smart_fetch wrapper:

from supadns import smart_fetch

headers = {"apikey": "your-anon-key", "Authorization": "Bearer your-anon-key"}
resp = smart_fetch(
    "https://myproject.supabase.co/rest/v1/todos?select=*",
    headers=headers
)
print(resp.json())

Standalone DoH Resolution

If you just need to bypass DNS and get the IPv4 address:

from supadns import resolve_doh

ip = resolve_doh("myproject.supabase.co")
# → "104.18.x.x"

How It Works

  1. System DNS First: Always tries standard DNS resolution first. If it works, overhead is ~0ms.
  2. Failure Detection: Catches httpx.ConnectError and socket.gaierror specifically for *.supabase.co domains.
  3. DoH Fallback: Resolves the IPv4 address via https://dns.quad9.net/dns-query (RFC 1035 wire-format).
  4. TLS SNI: Connects a raw TCP socket to the resolved IP, then upgrades it to TLS using ssl.create_default_context().wrap_socket(server_hostname=original_host). This ensures Cloudflare's strict edge SSL terminates correctly.

Requirements

  • Python ≥ 3.9
  • httpx
  • supabase-py (if using the Supabase client wrapper)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supadns-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supadns-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file supadns-1.0.0.tar.gz.

File metadata

  • Download URL: supadns-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for supadns-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a3b8a415b371d631677ce76ad6ddd5baac4366b6290f602850c03c99739998a3
MD5 84093c1fca574b417d0975ae66dee622
BLAKE2b-256 0b6f986c6de5fab0f405715d035a6aa431d187592413863572d511ba09ecfc17

See more details on using hashes here.

File details

Details for the file supadns-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: supadns-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for supadns-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35336c1ce43edb139ae9a1d71dd47252e415775f0c7d77490776b7b4cff98321
MD5 589bb8a994123d29ff4b548a21caf7c4
BLAKE2b-256 0a505f465fc0add362fbf0d8c3a6d792070ebfd8c438979a6ab16c337df9fa03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page