| 10:45 pm on Dec 8, 2010 (gmt 0)|
Not sure I understand this. Redirects don't use Content-Type headers, because a redirect response contains no response-body...
The content-type goes with the content -- the redirected-to 'page' or resource.
Also, I'm not sure why you are redirecting to the IIS server; this sounds like a job for a reverse-proxy, not a redirect.
| 8:55 pm on Dec 10, 2010 (gmt 0)|
|Redirects don't use Content-Type headers, because a redirect response contains no response-body... |
I'm sorry for confusion. To see response headers I use 'Live HTTP headers' add-on. This is what they show in response to 'GET /ExampleScript.axd?d=tyugyYhiiWsnObeDq3PMcVgoVc9' request:
HTTP/1.1 302 Found
Date: Fri, 10 Dec 2010 20:33:55 GMT
Keep-Alive: timeout=15, max=100
Content-Type: text/html; charset=iso-8859-1
| 9:30 pm on Dec 10, 2010 (gmt 0)|
The resource returns "text/html" because the resource at the requested location is not a script, it's a redirect to another location.
That other location should return the correct header when, and only when, that other location is requested in a new and separate HTTP transaction.
The 302 redirect is dangerous. I am guessing that it should really be a 301 redirect.
| 9:44 pm on Dec 10, 2010 (gmt 0)|
Thank you, g1smd. The resource at the requested location is not a script but it is no 'text/html' either.
| 10:37 pm on Dec 10, 2010 (gmt 0)|
No. There is no need to do so. The correct response at the final URL is sufficent.
The redirect response could return a human-readable HTML page like:
<body><p>This page has moved. It's now located at <a href="www.example.com/somepage">www.example.com/somepage</a></p></body></html>
In that case, the page IS text/html.
| 1:16 am on Dec 14, 2010 (gmt 0)|
But note that even though a redirect *could* return a content-body (as above), no modern browsers ever show these.
| 2:10 am on Dec 14, 2010 (gmt 0)|
Sure, the browser doesn't show it, but such pages occasionally turn up in search results and in searchengine cache, and in that case the human readable message and link is useful! I was just explaining why "text/html" is correct, and why anything else is less than useful.
| 2:52 pm on Dec 16, 2010 (gmt 0)|
I intended only to point out that there's no pressing need to return a content-body with a 30x response code, and that the content-type returned with a 30x response code is not very important (in that context).
It is the content-type of the redirected-to URL that matters.
| 2:01 pm on Dec 18, 2010 (gmt 0)|
Thank you g1smd and jdMorgan. I'm still struggling to understand what is going on. If I use Chrome Developer Tools on the Console tab there is a warning "Resource interpreted as script but transferred with MIME type text/html". Every time this warning is activated, the target server is again 302 redirecting (browser request for the .axd resource file), but this time to a 404 page.