Content-Type and redirect?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
3 views
What Content-Type should give the server if the server redirects the request, for example, to the image? That is, the second response from the server with Content-Type: image/jpeg. I thought all the same. My server returns text/html. But chrome considers this an error and displays a warning in the console.


Here is an example from the main page of Yandex:

Resource interpreted as image but transferred with MIME type .
Resource interpreted as image but transferred with MIME type text/plain.



UP.:

Most likely, I should not call it a mistake... Just me (and the chrome), this situation seems strange.
by | 3 views

3 Answers

0 like 0 dislike
Can anything except the header: "Location: newaddress/image.jpg" not to return.
The browser will make a request to the new address, and then type it will return.
by
0 like 0 dislike
Checked:
\r$picname = $_GET['picname']. '.jpg';
header('Content-Type: text/plain');
header('Location: '. $picname);
The server give HTTP 302 Moved Permanently and Chrome dutifully moved to the desired URL, it already received the HTTP 200 OK Content-Type: image/jpeg.
by
0 like 0 dislike
This is what gives, for example, Yandex:
\r
GET / HTTP/1.1
Host: yandex.ru
...
\r
HTTP/1.1 301 Moved Permanently
Date: Fri, 24 Sep 2010 22:18:20 GMT
Server: Apache/2.2.9 (Unix) mod_perl/2.0.4 Perl/v5.8.8
Location: www.yandex.ru/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 189
Connection: close
Content-Type: text/html; charset=iso-8859-1
\r
It is impossible to download the source code for: yandex.ru/
\r
It is also Chrome swears?
Here is an example from the wiki en.wikipedia.org/wiki/URL_redirection:
\r
HTTP/1.1 301 Moved Permanently
Location: www.example.org/
Content-Type: text/html
Content-Length: 174
\r
Moved
\r
\r

Moved


This page has moved to http://www.example.org/.
\r
\r
\r
Maybe some other error?
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
26,133 users