PAC file condition statement when to use "localHostOrDomainIs" or "shExpMatch"?


Hi all, when do we use these 2 statement condition statement ?

I do realised most of the bypassing we are using

if (shExpMatch(host, “”))

But recently i got to know the actual way is to use

if (shExpMatch(url, “”))

But in tunnel 2.0 bypassing i was reading through the documentation ( for domain bypass its recommended to use

(localHostOrDomainIs(host, “”))

For localHostOrDomainIs the available options to use is only host or there can be URL too ?

By default nowadays browsers strip privacy and security sensitive parts (ie both path and query parameters) off from url, so it is - except for the port which comes in url but not host - basically ‘url=host:port’.

For bypassing URL somehow for localHostOrDomainIs(host,"") it will not work, same goes if i change it to localHostOrDomainIs(url,""). So i am wondering for localHostOrDomainIs when will we use on

You try too match against “” - which is essentially nothing.
The only time this would match is if host or url are empty.

The docu you refer to clearly shows

if (localHostOrDomainIs(host, "<domain>"))

So you need to set domain to whatever you need.

o apologise i was copy pasting the code and forgot to add in the url i am referring to as an example.

For below the two method it didnt work well…

localHostOrDomainIs(host,“”) OR localHostOrDomainIs(url,“”)

I presume what you wanted to convey is that localHostOrDomainIs(host,“”) only works for domains instead for URL? correct me if i am wrong.

here is a description about how localHostOrDomainIs is working -

If you use host or url variable should not make much of a difference though; as said url is equal to host:port
means for