Virtual Hosting: Browsers and PAC

From The Uniform Server Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

MPG UniCenter

Virtual Hosting: Home | Name based | PAC | Browsers and PAC | Making it portable | Issues

Browsers and PAC
Uniform Server 3.5-Apollo

Installing the PAC file is easy I use both Firefox and Opera always dread firing up IE6 for testing; can almost guarantee to hit some problem. To my surprise it worked although I always get confused when to use a forward or backward slash.

Interestingly you will notice Firefox requires three forward slashes after “file” although technically correct again confusing. Well I am easily confused hence the images, if I have not covered your browser at least these three will give you some idea where to look.

I located my PAC file (test.pac) at the top level on G drive (makes for less typing) if you choose to bury it in sub-folders enjoy the typing. Note, the file can be located anywhere you like.

Firefox 2.x.x.x 3.0

I am biased when it comes to browsers and they are listed in order of preference Firefox is my personal favorite.

  1. Run Firefox
  2. Select Tools > Options
  3. Select Advanced Icon
  4. Select Network Tab
  5. Click Settings button
  6. Check Automatic proxy configuration URL radio button
  7. Type-in file:///G:/test.pac
  8. Click OK twice to close both dialogs.

Note: Item 6 use this to enable or disable the file as and when required.

Alternative method: Firefox has another method of doing things perhaps you may prefer this alternative:

  1. Run Firefox
  2. Type about:config in the address bar, then press [Enter]
  3. Type autoconfig in the Filter bar
  4. Double-click the network.proxy.autoconfig_url (edit box pops up)
  5. Type-in file:///G:/test.pac
  6. Click OK

Top

Opera 9.10

  1. Run Opera
  2. Selets Tools > Preferences
  3. Select 'Advanced tab
  4. Select Network (menu on the left)
  5. Click Proxy servers button
  6. Check on the Use automatic proxy configuration checkbox
  7. Type-in file://G:/test.pac
  8. Click OK twice to close both dialogs.


Note 1: Make sure you use forward slashes.

Note 2: Make sure you enter file with two forward slashes file://G:/test.pac

Top

IE 6

  1. Run Internet Explorer
  2. Select Tools > Internet Options
  3. Select Connections tab
  4. Click the LAN Settings button
  5. Check Use automatic configuration script checkbox
  6. Type-in file://G:\test.pac
  7. Click OK twice to close both dialogs.


Note 1: Make sure you enter file with two forward slashes file://G:\test.pac

Note 2: Make sure you use back slashes for the rest of the file name.

Top

Testing

If it not already running start Uniform Server and type into your browser address bar the site names you setup on the previous page (reproduced below):

Addresses
  • www.my_site1.fredtest.mine.nu 
  • www.my_site2.fredtest.mine.nu
  • www.ric.com

Test your links (relative, root relative and absolute) if you are working on sites that are cross-linked these will also work.

Top

Summary

With just a few lines of code you can simulate a DNS server allowing you to be that little more confident your sites will work when published.

This write-up was inspired by dimo414 for asking such awkward questions over on the forum. I have always used the local hosts file to implement this type of solution. However when replying to dimo414 it triggered the idea of a fully portable testing server including browser see next page for this solution.

Top


Ric