Skip to content

Instantly share code, notes, and snippets.

View MDCore's full-sized avatar

Gavin van Lelyveld MDCore

  • Bristol, England
View GitHub Profile
@MDCore
MDCore / 2-https-proxy.lua
Created July 9, 2026 23:03
koreader patch to allow http proxies when using tailscale
-- 2-https-proxy.lua
-- KOReader userpatch: enable HTTPS requests through an HTTP CONNECT proxy.
--
-- Stock LuaSec (ssl.https) refuses to use a proxy for HTTPS ("proxy not
-- supported"). This is a problem when reaching tailnet services via a
-- userspace Tailscale HTTP-CONNECT proxy (e.g. 127.0.0.1:1056) on devices
-- with no TUN module, where DNS for *.ts.net can't be resolved locally.
--
-- This patch reimplements ssl.https' internal `tcp` connector to open a
-- CONNECT tunnel through the proxy (so the proxy resolves the hostname and