KB #05: Transforming a .pac script into an exclusion list
Description
Isolate URLs excluded by a .pac script in the form of a list.
Context
In the case of an on-premise to SaaS migration, the administrator needs to import the proxy's flow exclusions. If the exclusions are indicated as a list in a GPO, then he can directly copy and paste this list. But if he uses a .pac script to indicate these exclusions and the proxy through which he must pass, then he must retrieve the excluded URLs via a tedious job of isolation and copy-paste. This KB is designed to facilitate this process, using regular expressions (known as RegEx for "regular expression").
Prerequisites
Have a proxy.pac script
Procedure
Let's take the example of this proxy.pac :
To extract all hostnames in list format with only the hostname, use this RegEx :
/(?<=host\ \=\=\=\ \ »)(.*?)(?=\ »)/gm
To apply it, go to https://regexr.com and copy the resulting list directly into the "List" tab in the second half of the screen:
Screenshot from regexr.com
Finally, to extract all excluded domain names with the dnsDomainIs comparison method, we use this RegEx :
/(?<=dnsDomainIs\(host\,\ »)(.*?)(?=\ »\))/gm
You can use regexr.com again to apply this RegEx.
You can concatenate the two lists and paste the resulting list in: Configuration > Traffic management > (Edit your .pac) > Content > Multiple editing.
Note
Don't forget to save by clicking on "Validate" then "Save and exit".