RavenLame
CDCloudflare Developers
•Created by RavenLame on 10/3/2024 in #pages-help
Hosting proxy pac on workers
Hello, just trying to follow the documentation regarding using Gateway without WARP. I've seen the possibility to host the pac file on workers :
https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/agentless/pac-files
here is the template :
=========================================================
function FindProxyForURL(url, host) {
// No proxy for private (RFC 1918) IP addresses (intranet sites)
if (
isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0")
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0")
isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0")
) {
return "DIRECT";
}
// No proxy for localhost
if (isInNet(dnsResolve(host), "127.0.0.0", "255.0.0.0")) {
return "DIRECT";
}
// Proxy all
return "HTTPS 3ele0ss56t.proxy.cloudflare-gateway.com:443";
}
=========================================================
but once added in a worker, I can't deploy it, I've got the following error : No event handlers were registered. This script does nothing. ==> I customized my proxy endpoint of course
4 replies