Retun proxy as fqdn in pac file

(ram) #1

Hi All,
I need help creating a simple pac file, i want to add fqdn in place of IP address of return proxy statement. I know variable need to used but how that vairlable will be resolve to IP address is not clear for me.
Can somebody help or provide a simple pac file for reference.
My simple pac file

function FindProxyForURL(url, host) {

      return "PROXY; PROXY";


In place of ip address i need to configure fqdn variable and that variable need to resolve. Please help me.

with regards,

(Rajeshkumar Chemalli) #2

Hi Ram,

you may use the below:

function FindProxyForURL(url, host) {

  return "PROXY; PROXY";


But this and should be resolved at your DNS. When you use this PAC file the browser will try to resolve the proxy FQDNs.

Please refer the KB article on best practices of writing a PAC file


(Charles Repain) #3

Variables are resolved because you host your PAC file to Zscaler Cloud. If you don’t host your PAC at Zscaler, you can’t use variables.
Zscaler will see the source IP you have to grab the PAC file, and based on that will replace variables with IP of the closest node.

(ram) #4

Thanks,RajeshKumar_Chemalli & Charles_Repain
I got confused because of $gateway variable in documentation. Now understood that I need to use only when my pac is hosted on the cloud. Thanks again.

(Gordon Wright) #5

If you are using ZApp in tunnel mode and use a return statement for a proxy it will always forward on port 443 and not the custom port 8888 you have listed above.