Automatic proxy configuration for laptop-users

It is after long time when I am writing anything – was busy in delivery of the much-awaited software to the customer. Whew, finally done!
This article presents a way for laptop-users to automatically pick-up the correct proxy-server configuration required to access the internet. I typically use my laptop in office network  and at home. In the office network, internet connection must be made through the proxy-server whereas at home I have direct access to the internet. Every single day, depending on where I am (at office or home), I needed to change the browser settings. After digging it over the internet, I found a way to automatically configure the browser for proxy. Following are the steps that I followed to fix this hassle:
1.       1. Create a .pac file (say, myproxy.pac). Copy and paste following text in this file.
function FindProxyForURL(url, host)
{
   if (isInNet(myIpAddress(), "10.3.204.254", "255.255.252.0"))
     return "PROXY officeproxy:8080";
   else
     return "DIRECT";
}

2.      2. In above text, 10.3.204.254 is IP Address and 255.255.252.0 is Subnet Mask. This will be different for you compared to mine and compared to which network (office or home) you are presently in. The IP address and Subnet Mask need to be replaced with the correct ones for you. When you are in office network (the place where you need to use proxy server), open a command prompt (cmd.exe) and then invoke “ipconfig” command there. It will give the required information (refer following picture).
   
      3. After correcting the IP Address and Subnet Mask, replace the officeproxy:8080 in the file with the name of proxy-server and port that you need to use, when you are in the mentioned network.
4.      
             4. Out of the above mentioned network, I do not need to use any proxy-server and direct connection is possible. And so, this is what else part of the .pac does.
4.      
     5.  Next, you need to change the setting of your browser to use this automatic configuration
a.       If you use Internet Explorer, go to “Internet Options” -> “Connections” -> “LAN settings”. Check on the “User automatic configuration script” and give the path/address of the .pac file.

b.      If you use Firefox browser, go to “Tools” -> “Options” -> “Advanced” -> “Network” -> “Settings”. Choose “Automatic Configuration URL” and give the path of your .pac file. Finally, press reload.

        6.       That is all, you are ready to seamlessly browse the internet in office and home without worry about the proxy configuration. It is all done once. In case you have different requirement, you can enhance the .pac file further to satisfy your need. Read following link for more details: http://nscsysop.hypermart.net/proxypac.html
Automatic proxy configuration for laptop-users Automatic proxy configuration for laptop-users Reviewed by Sourabh Soni on Saturday, September 11, 2010 Rating: 5

No comments

Author Details

Image Link [https://3.bp.blogspot.com/-zo21XIdyPqc/VuTrFfUyPhI/AAAAAAAAAO8/EEWTN73XHUA7aTIjuxuBSN-WGaGkNUymA/s1600/sourabhdots3.jpg] Author Name [Sourabh Soni] Author Description [Technocrat, Problem Solver, Corporate Entrepreneur, Adventure Enthusiast] Facebook Username [sourabh.soni.587] Twitter Username [sourabhs271] GPlus Username [#] Pinterest Username [#] Instagram Username [#] LinkedIn Username [sonisourabh] Youtube Username [sonisourabh] NatGeo Username [271730]