There are many sites out there that are still useful or even targeted to legacy systems and browsers nowadays, and to better integrate them with the proxy in my usage I have added a simple whitelisting system that bypasses proxying for any domains listed in a file called whitelist.txt in the same directory as the main script. With this, you can now use the proxy while also still being able to access new or still-extant sites that run well on your system, like FrogFind or Floodgap that are both provided as examples in the default whitelist.
All changes are implemented in the Handler class:
When a Handler is instantiated, it will now attempt to read from a file named whitelist.txt in the script directory
The contents of whitelist.txt will be read and split by \n into a list property self.whitelist
If whitelist.txt does not exist or cannot be opened, self.whitelist will be initialized to an empty list instead
If the determined hostname variable matches any member of self.whitelist, the proxy will request the URL as-is.
One caveat to this current implementation is that it does not pass through to subdomains, so separate lines on the file will be needed for domain.com and www.domain.com as examples. Reading in the file with every request does not appear to have any meaningful performance impact in my testing and allows for on-demand updates without restarting the proxy.
Thank you for your time, and please let me know if you have any questions or ideas to improve these changes.
There are many sites out there that are still useful or even targeted to legacy systems and browsers nowadays, and to better integrate them with the proxy in my usage I have added a simple whitelisting system that bypasses proxying for any domains listed in a file called
whitelist.txt
in the same directory as the main script. With this, you can now use the proxy while also still being able to access new or still-extant sites that run well on your system, like FrogFind or Floodgap that are both provided as examples in the default whitelist.All changes are implemented in the
Handler
class:Handler
is instantiated, it will now attempt to read from a file namedwhitelist.txt
in the script directorywhitelist.txt
will be read and split by\n
into a list propertyself.whitelist
whitelist.txt
does not exist or cannot be opened,self.whitelist
will be initialized to an empty list insteadhostname
variable matches any member ofself.whitelist
, the proxy will request the URL as-is.One caveat to this current implementation is that it does not pass through to subdomains, so separate lines on the file will be needed for
domain.com
andwww.domain.com
as examples. Reading in the file with every request does not appear to have any meaningful performance impact in my testing and allows for on-demand updates without restarting the proxy.Thank you for your time, and please let me know if you have any questions or ideas to improve these changes.