HTTP proxy server to support Home Assistant integration with AdGuard Home behind GL.iNet routers requiring authentication.
This proxy server sits between Home Assistant and AdGuard Home when the AdGuard Home instance is behind a GL.iNet router that requires authentication. The proxy:
- Receives requests intended for the AdGuard Home API
- Authenticates with the GL.iNet router using its API
- Forwards the requests to the real AdGuard Home with the necessary authentication cookies
- Returns the responses to Home Assistant
- Handles reauthentication if needed
This proxy is specifically designed to work with GL.iNet routers using their authentication API as documented here: https://web.archive.org/web/20240121142533/https://dev.gl-inet.com/router-4.x-api/
The proxy uses the GL.iNet authentication endpoints to obtain a session ID (sid) and adds it as an "Admin-Token" cookie for AdGuard Home requests. The authentication follows the standard GL.iNet API flow:
- Get challenge parameters from the router
- Calculate password hash using the provided salt
- Login with the hash to obtain a session ID
- Use the session ID as a cookie for subsequent requests
The server is configured using environment variables:
ROUTER_HOST: Hostname or IP address of the GL.iNet router (e.g., 192.168.8.1)ROUTER_USERNAME: Username for GL.iNet router authentication (defaults to "root")ROUTER_PASSWORD: Password for GL.iNet router authenticationROUTER_SSL_VERIFY: SSL certificate verification for the router connection. Set to "false" to disable SSL verification, "true" to use system CA certificates, or specify a path to a custom CA bundle file (default: "true")ADGUARD_URL: URL of the actual AdGuard Home instanceLOG_LEVEL: Logging level (default: INFO)HOST: Host to bind the server to (default: 0.0.0.0)PORT: Port to run the server on (default: 8000)
docker run -p 8000:8000 \
-e ROUTER_HOST=192.168.8.1 \
-e ROUTER_PASSWORD=password \
-e ADGUARD_URL=http://adguard.local \
-e ROUTER_SSL_VERIFY=false \ # Only if your router uses a self-signed certificate
gl-adguard-bridge- Clone the repository
- Install dependencies with uv:
uv pip install -e ".[dev]" - Run the server:
python -m gl_adguard_bridge
MIT