Fix Firefox managed proxy profile to allow website loading.

Uses a clean manual HTTP/SSL proxy configuration, clears conflicting SOCKS fields, and stops writing prefs.js so Firefox can manage runtime prefs correctly.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Indiana Holmes
2026-05-16 13:50:27 -07:00
parent d4296763ee
commit 8bd8d4267f

View File

@@ -57,14 +57,17 @@ def build_user_js(
lines.extend( lines.extend(
[ [
'user_pref("network.proxy.type", 1);', 'user_pref("network.proxy.type", 1);',
'user_pref("network.proxy.share_proxy_settings", true);',
f'user_pref("network.proxy.http", "{proxy_host}");', f'user_pref("network.proxy.http", "{proxy_host}");',
f'user_pref("network.proxy.http_port", {int(proxy_port)});', f'user_pref("network.proxy.http_port", {int(proxy_port)});',
f'user_pref("network.proxy.ssl", "{proxy_host}");', f'user_pref("network.proxy.ssl", "{proxy_host}");',
f'user_pref("network.proxy.ssl_port", {int(proxy_port)});', f'user_pref("network.proxy.ssl_port", {int(proxy_port)});',
f'user_pref("network.proxy.socks", "{proxy_host}");', 'user_pref("network.proxy.ftp", "");',
f'user_pref("network.proxy.socks_port", {int(proxy_port)});', 'user_pref("network.proxy.ftp_port", 0);',
'user_pref("network.proxy.socks", "");',
'user_pref("network.proxy.socks_port", 0);',
'user_pref("network.proxy.socks_version", 5);', 'user_pref("network.proxy.socks_version", 5);',
'user_pref("network.proxy.socks_remote_dns", true);', 'user_pref("network.proxy.socks_remote_dns", false);',
'user_pref("network.proxy.no_proxies_on", "");', 'user_pref("network.proxy.no_proxies_on", "");',
] ]
) )
@@ -114,13 +117,6 @@ def build_user_js(
return "\n".join(lines) return "\n".join(lines)
def build_prefs_js_marker() -> str:
return (
"// Proxy God managed profile\n"
'// Do not edit manually; user.js is rewritten on launch.\n'
)
def ensure_firefox_profile( def ensure_firefox_profile(
profile_dir: Path, profile_dir: Path,
proxy_host: str, proxy_host: str,
@@ -132,4 +128,3 @@ def ensure_firefox_profile(
build_user_js(proxy_host, proxy_port, hard), build_user_js(proxy_host, proxy_port, hard),
encoding="utf-8", encoding="utf-8",
) )
(profile_dir / "prefs.js").write_text(build_prefs_js_marker(), encoding="utf-8")