question

NetOps22-6393 avatar image
0 Votes"
NetOps22-6393 asked NetOps22-6393 edited

IIS8 Strange redirects to 302 after a 200

Hello Everyone!

I am currently using IIS 8.1 in Windows Server 2012, to serve a small website, the website looks and works fine, the strange thing that I noticed happens when you request a single file as for example https://192.168.1.26/pico/favicon.ico, Using Chrome, Firefox or different computers you can see in the browser's Network Console this behavior

200 favicon.ico https://192.168.1.26/pico/favicon.ico

302 favicon.ico https://192.168.1.26/favicon.ico

200 error404.html https://192.168.1.26/pico/errors/error404.html

As I understand I should only get the 200 but I see that in the Browser network console.

I do have custom error pages for 404 most likely I see that because https://192.168.1.26/favicon.ico does not exist in the web.

I currently have two small Sites in IIS the first one works fine(does not have this strange behavior) but this second one does this strange redirect to 302, I can't find any redirect in the IIS options.

Curl to the file works simply responds with 200 no issues at all.


144590-image.png

Thanks for you help I am not very good with IIS and haven't been able to find an answer.


windows-server-iis
image.png (43.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @NetOps22-6393 ,

The first favicon is under pico and it is really exists. So it is loaded successfully and status code is 200.

The second favicon should in the root folder of the application, but it seems that there's no file named favicon.ico in root folder. Generally, it should be 404 but now it is 302. Maybe some redirect rules caused this or any other reasons. So I think you need to use failed request tracing to check the process of this request. You just need to check the url https://192.168.1.26/favicon.ico, how IIS receive the request and handle it and feedback response.


0 Votes 0 ·

1 Answer

cooldadtx avatar image
0 Votes"
cooldadtx answered NetOps22-6393 edited

Do you have a favicon.ico in your pico app?
What framework are you using for your web app?
When you installed IIS did you enable the feature Static Content under World Wide Web Services\Common HTTP Features?
If you Ctrl+F5 to refresh the browser does the problem go away?
What request headers are sent back as part of the initial 200 response?

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you have a favicon.ico in your pico app? Yes, When I request the file it works fine but in the browser's network console I see the error described in the post
What framework are you using for your web app? The web app is a simple HTML that gets data from a dataflex app
When you installed IIS did you enable the feature Static Content under World Wide Web Services\Common HTTP Features? Yes
If you Ctrl+F5 to refresh the browser does the problem go away? No, the problem never goes away




0 Votes 0 ·

What request headers are sent back as part of the initial 200 response?

Request
GET /pico/favicon.ico HTTP/1.1
Host: 192.168.1.26
Connection: keep-alive
Cache-Control: max-age=0
sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,es;q=0.8
Cookie: dfWebApp=63EBDE92-4CA5-4763-8EF0-F3C0AD652177

Response
HTTP/1.1 200 OK
Content-Type: image/x-icon
Last-Modified: Thu, 23 May 2019 17:55:57 GMT
Accept-Ranges: bytes
ETag: "5c836ec69011d51:0"
Server: Microsoft-IIS/8.5
Date: Thu, 28 Oct 2021 19:02:52 GMT
Content-Length: 5430

0 Votes 0 ·

Second Request

GET /favicon.ico HTTP/1.1
Host: 192.168.1.26
Connection: keep-alive
sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
DNT: 1
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
sec-ch-ua-platform: "Windows"
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/*;q=0.8
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: image
Referer: https://192.168.1.26/pico/favicon.ico
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,es;q=0.8


Second Response

HTTP/1.1 302 Redirect
Content-Type: text/html; charset=UTF-8
Location: https://192.168.1.26/errors/error404.html
Server: Microsoft-IIS/8.5
Date: Thu, 28 Oct 2021 19:02:52 GMT
Content-Length: 164

0 Votes 0 ·

I don't think there is anything wrong with your site. This is just Chrome being Chrome. When you make a request in Chrome it executes the request and then, if it doesn't have an icon cached for the URL, it makes a call to get the favicon which it then loads into the browser tab window. You can see this same behavior browsing other sites as well (e.g. https://www.microsoft.com/favicon.ico).

As for the 404 error did you create a web app for pico or is it a virtual directory. If it is a virtual directory then /pico/favicon.ico is stepping into the virtual directory of pico contained in the default website. Ideally you don't have directory browsing enabled for your site. If it is a virtual directory then convert it to an app and see if it starts finding the correct icon at that point.

0 Votes 0 ·

Well, it was a an app using a virtual path, I just put a copy of the favicon.ico in the Site physical/Root folder and live with it, no more 404, thank you!

0 Votes 0 ·