Lewis Robertson
asked on
Issue serving proxy.pac file as a webpage through IIS7.
Hello all,
I've spent so many hours on this now and can't figure it out.
I've created a really basic proxy.pac file, published as a website in IIS7.
Chrome and Firefox show the contents of the pac file within the browser as plain text, this is good.
But Internet Explorer always tries to download the file when I go to the URL!
It's driving my crazy trying to figure this out!
Only specific changes I've made in IIS7 are...
- MIME type (.pac) = application/x-ns-proxy-aut oconfig
- HTTP response header (Content-Type) = text/plain
I am an amateur at IIS, been working in IT for 13 years but first time looking at this stuff.
First time I've ever had to post anything technical on a forum because I'm completely stumped.
I'm sure it's going to be one simple setting somewhere that I've missed, But I must have clicked on every Google result ever trying to find the answer!
Screenshots attached.
Please help I will be so grateful : - )
Thank you,
Lewis.
chrome.jpg
InternetExplorer.jpg
I've spent so many hours on this now and can't figure it out.
I've created a really basic proxy.pac file, published as a website in IIS7.
Chrome and Firefox show the contents of the pac file within the browser as plain text, this is good.
But Internet Explorer always tries to download the file when I go to the URL!
It's driving my crazy trying to figure this out!
Only specific changes I've made in IIS7 are...
- MIME type (.pac) = application/x-ns-proxy-aut
- HTTP response header (Content-Type) = text/plain
I am an amateur at IIS, been working in IT for 13 years but first time looking at this stuff.
First time I've ever had to post anything technical on a forum because I'm completely stumped.
I'm sure it's going to be one simple setting somewhere that I've missed, But I must have clicked on every Google result ever trying to find the answer!
Screenshots attached.
Please help I will be so grateful : - )
Thank you,
Lewis.
chrome.jpg
InternetExplorer.jpg
ASKER
Hi, thanks for responding.
Already seen that link on my travels and checked everything.
I'm certain my issue is something to do with HTTP Response Headers.
If I remove Content-Type text/plain, Chrome then offers file download rather than showing inline, same as IE.
Put Content-Type text/plain back in and Chrome shows file contents in browser as per screenshot.
It's as if Internet Explorer is completely ignoring the HTTP Response Headers.
Whereas Chrome sees the change and responds to it.
Already seen that link on my travels and checked everything.
I'm certain my issue is something to do with HTTP Response Headers.
If I remove Content-Type text/plain, Chrome then offers file download rather than showing inline, same as IE.
Put Content-Type text/plain back in and Chrome shows file contents in browser as per screenshot.
It's as if Internet Explorer is completely ignoring the HTTP Response Headers.
Whereas Chrome sees the change and responds to it.
How are you setting up IE? Are you manually setting up the proxy settings or using auto-detect?
Link: https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/
Auto-detect has different requirements for DNS, DHCP and the file.
Dan
Link: https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/
Auto-detect has different requirements for DNS, DHCP and the file.
Dan
Also discussed before here on EE: https://www.experts-exchange.com/questions/27549404/PAC-Autoconfig-Script-ignored-by-IE.html
Dan
Dan
ASKER
Manually. But at this stage I'm not actually attempting to filter my traffic.
I'm literally just trying to get IIS to display this pac file's content as a webpage in internet explorer, rather than it being offered as a download.
I've just been testing further here trying to get Internet Explorer to display other proxy file formats...
.jvs, .js, .dat, all have the same issue in Internet Explorer. But all work in Chrome.
I'm literally just trying to get IIS to display this pac file's content as a webpage in internet explorer, rather than it being offered as a download.
I've just been testing further here trying to get Internet Explorer to display other proxy file formats...
.jvs, .js, .dat, all have the same issue in Internet Explorer. But all work in Chrome.
Have you tried setting the HTTP Response Header to the content type of application/x-ns-proxy-aut oconfig?
Dan
Dan
ASKER
Yep tried that and just tried again, same issue.
Thing is that I know IE can definitely display a .dat file as our old proxy server publishes it's own using HTTPAPI and that works in IE fine. So it's not even a case of IE not supporting the file types, I have proof that it can. It's driving me a bit insane trying to crack this lol.
Thing is that I know IE can definitely display a .dat file as our old proxy server publishes it's own using HTTPAPI and that works in IE fine. So it's not even a case of IE not supporting the file types, I have proof that it can. It's driving me a bit insane trying to crack this lol.
Setting the .pac MIME type to plain/text will server it up across all browsers.
Dan
Dan
ASKER
Just tried that and getting the same issue.
By the way I'm testing this across 3 different laptops, one with IE8, one with IE10, one with IE11.
By the way I'm testing this across 3 different laptops, one with IE8, one with IE10, one with IE11.
Before my last post, I setup a .pac file on a site and was able to display the proxy.pac file in IE11 when the content-type was set to plain text.
Purge your IE cache.
Dan
Purge your IE cache.
Dan
ASKER
Already tried clearing all history on all 3 laptops, still same issue.
Try setting it up under another URL path.
Setting the .pac MIME type to text/plain does server it up as a text file in IE11. I've verified it on 4 different IIS Servers.
Server 2008 R2, Server 2012, Server 2012 R2 & Server 2016. (IIS7.5, 8, 8.5 & 10) IIS7 and IIS7.5 can be considered the same.
Dan
Setting the .pac MIME type to text/plain does server it up as a text file in IE11. I've verified it on 4 different IIS Servers.
Server 2008 R2, Server 2012, Server 2012 R2 & Server 2016. (IIS7.5, 8, 8.5 & 10) IIS7 and IIS7.5 can be considered the same.
Dan
If you have an HTTP Response Header for content-type for text/plain... you should remove it after setting the .pac MIME type to text/plain.
I was able to reproduce the issue. MIME type was text/plain & site was pushing a content-type of text/plain. Removing the response header resolved the display issue.
Dan
I was able to reproduce the issue. MIME type was text/plain & site was pushing a content-type of text/plain. Removing the response header resolved the display issue.
Dan
ASKER
Sorry, same issue after trying both suggestions : - (
Can you see why it is driving me insane lol.
Can you see why it is driving me insane lol.
From a "Run as Admin" console, type the following and please post back:
- C:\Windows\System32\inetsr v>appcmd list apppools
- C:\Windows\System32\inetsr v>appcmd list sites
Are you trying to use the "Default Web Site?"
Dan
- C:\Windows\System32\inetsr
- C:\Windows\System32\inetsr
Are you trying to use the "Default Web Site?"
Dan
ASKER
APPPOOL "DefaultAppPool" (MgdVersion:v4.0,MgdMode:I ntegrated, state:Star ted)
APPPOOL "Intranet" (MgdVersion:v4.0,MgdMode:I ntegrated, state:Star ted)
APPPOOL "ASP.NET v4.0" (MgdVersion:v4.0,MgdMode:I ntegrated, state:Star ted)
APPPOOL "ASP.NET v4.0 Classic" (MgdVersion:v4.0,MgdMode:C lassic,sta te:Started )
APPPOOL "IntranetV3" (MgdVersion:v4.0,MgdMode:I ntegrated, state:Star ted)
APPPOOL "Intranet Dev" (MgdVersion:v2.0,MgdMode:I ntegrated, state:Star ted)
APPPOOL "Classic .NET AppPool" (MgdVersion:v2.0,MgdMode:C lassic,sta te:Started )
APPPOOL "WebFilter" (MgdVersion:,MgdMode:Integ rated,stat e:Started)
SITE "Default Web Site" (id:1,bindings:http/*:80:, net.tcp/80 8:*,net.pi pe/*,net.m smq/localh ost,msmq.f ormatname/ localhost, state:Star ted)
SITE "Intranet" (id:2,bindings:http/10.1.0 .6:80:intr anet.co.uk ,http/10.1 .0.6:80:in tranet,sta te:Started )
SITE "Intranet Dev" (id:3,bindings:http/*:80:d ev-intrane t,http/*:8 0:dev-intr anet.mts.l ocal,state :Started)
SITE "WebFilter" (id:4,bindings:http/10.1.0 .6:80:mts- webfilter, state:Star ted)
APPPOOL "Intranet" (MgdVersion:v4.0,MgdMode:I
APPPOOL "ASP.NET v4.0" (MgdVersion:v4.0,MgdMode:I
APPPOOL "ASP.NET v4.0 Classic" (MgdVersion:v4.0,MgdMode:C
APPPOOL "IntranetV3" (MgdVersion:v4.0,MgdMode:I
APPPOOL "Intranet Dev" (MgdVersion:v2.0,MgdMode:I
APPPOOL "Classic .NET AppPool" (MgdVersion:v2.0,MgdMode:C
APPPOOL "WebFilter" (MgdVersion:,MgdMode:Integ
SITE "Default Web Site" (id:1,bindings:http/*:80:,
SITE "Intranet" (id:2,bindings:http/10.1.0
SITE "Intranet Dev" (id:3,bindings:http/*:80:d
SITE "WebFilter" (id:4,bindings:http/10.1.0
Which site is hosting the .pac file?
Dan
Dan
ASKER
Apologies, it is the one called WebFilter.
On the WebFilter site, can you add the following HTTP Response Header:
NAME: Content-Disposition
VALUE: inline
I came across a note while reading deep thru this article from MSDN: https://msdn.microsoft.com/en-us/library/gg622940(v=vs.85).aspx
Dan
NAME: Content-Disposition
VALUE: inline
I came across a note while reading deep thru this article from MSDN: https://msdn.microsoft.com/en-us/library/gg622940(v=vs.85).aspx
Dan
ASKER
Done. Still same issue.
Thanks for taking the time to help wit this by the way : - )
<httpProtocol>
<customHeaders>
<add name="Content-Disposition" value="inline" />
</customHeaders>
</httpProtocol>
Thanks for taking the time to help wit this by the way : - )
<httpProtocol>
<customHeaders>
<add name="Content-Disposition"
</customHeaders>
</httpProtocol>
Have you tried IE in compatibility mode?
I'm leaning toward an IE issue, not necessarily an IIS setup issue.
Dan
I'm leaning toward an IE issue, not necessarily an IIS setup issue.
Dan
ASKER
Hi again, yep tried that.
3 different laptops too.
Same issue.
3 different laptops too.
Same issue.
Are your computers sitting behind a proxy that doesn't bypass local addresses?
It's a stretch of a question, but I am running out of ideas. This appears to be a cache issue, especially after changing the Response Header content type to plain text. I was able to reproduce your scenario on my system and then resolve it.
Dan
It's a stretch of a question, but I am running out of ideas. This appears to be a cache issue, especially after changing the Response Header content type to plain text. I was able to reproduce your scenario on my system and then resolve it.
Dan
ASKER
They are not sitting behind any proxy.
I've given up on this now, but thanks for your responses Dan, much appreciated.
I've given up on this now, but thanks for your responses Dan, much appreciated.
Sorry we weren't able to find a solution to your situation.
Dan
Dan
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Link: https://marckean.com/2010/02/09/setting-up-proxy-pac-files-in-iis7-for-proxy-use/
The major item is to set up a dedicated site to server up the file. As the article mentions, I also recommend setting up a dedicated FDQN for the site... I'm a fan of http or https://proxy.mydoamin.com
Dan