Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
155

As you correctly note, the Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is. However, as you may have noticed, HTTP requests can also contain Content-Type ...


25

You can't really control what headers user agents decide to send to you. If the file in question is in the browser's cache and it decides it need to check for a new version then it will. According to this article, these are the situations browsers will request using If-Modified-Since: The cached entry has no expiration date and the content is being ...


22

Accept: is what the browser is able to digest, for example, all the languages someone can understand. Content-Type: is what format the actual data is in, for example what language someone is speaking. Since computers can't (well, now they can) recognize other types like people can say "oh, he's German!" or "she's speaking Chinese!"


20

Accept is like Here is my request and I would like (to Accept) this response format Content-Type is like Here is my request (or response) and this (Content-Type) is the format of the content I am sending in my request (or response)


19

It is referring to Response Headers and not document body ("Content-Type tag"). If you check Response Headers of your page with any HTTP Debugger (for example, Net panel of Firebug for Firefox, or similar tab of Developer Tools in Google Chrome/Internet Explorer/Safari/Opera), you will see this line: Content-Type: text/html At the same time, if you check ...


17

Change your htaccess file code on your website root directory (i.e. Your public_html ".htaccess" file) <FilesMatch "\.(ttf|otf|eot|woff|woff2)$"> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "http://skin.cdn.com" </IfModule> </FilesMatch> Now your CDN will be allowed to load your resource calling ...


16

It might come from 60 * 60 * 24 * 7 * 4 * 12 = 29030400 where each month consists of exactly 4 weeks.


15

According to the current version of the HTTP/1.1 standard, RFC 2616, the value of the Location header must be an absolute URI. However, in the draft standard prepared by the HTTPbis Working Group to eventually replace RFC 2616, this has been changed to allow relative URIs as well, apparently because: "The definition of the Location header [in RFC 2616] ...


12

After the site is closed sending a 410 Gone HTTP status code would be the proper way to do it as this will tell search engines those pages are gone for good and to remove them from their index. 404 will do this, too, but may take longer as the search engines will keep retrying to reach it several times before removing it from their index. Also, make sure ...


12

Unfortunately, you can't. Google search now exclusively uses HTTPS and all search result clicks go through an intermediate URL that removes the keywords. The URL you posted above appears to be that intermediate URL, and that's all you get as the referrer. The reasoning behind this is that each user of Google often gets personalised results based on their ...


10

In client-server applications, the IP address of the client (i.e., the browser) is sent via the socket connection (the request) to the server (e.g., Apache). If the client is using a proxy server however, that may be the proxy's IP address instead of the client's IP. Remote_Addr is an ENV returned by the server and available to server-side scripts/...


8

If the page is not replaced by new content Send a 410 GONE HTTP status message which tells search engines that the page doesn't exist anymore. Have the page's content tell the user why the page is gone and give them options for finding existing content on your website. This should links to your home page, site map (if one exists), search page (if one exists),...


8

It's correct to set this directive like RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS} If it doesn't work, you may need to install and enable the module mod_headers.


8

If you use the "Fetch as Google" tool in Google Search Console on a page that returns a "418 I'm a Teapot" status then it simply reports an "Error" and indexing cannot be requested for this page. In the screenshot below, the circled "Error"s are the result of requesting a page that returns a 418 status. No further information is available at this stage. ...


7

Yes. By the HTTP protocol, clause 7.2.1: “Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI ...


7

I have decided to serve only gzipped version of my pages If you're only serving files that you've compressed using gzip, then using Vary: Accept-Encoding will be of no benefit since there won't be uncompressed copies of the files to serve to clients that don't send Accept-Encoding: gzip in the HTTP request. Most clients these days do send this, so you ...


6

So is there a way in S3 to set a dynamic Expires that is always one year from the request date? Not that I know of, and I doubt that dedicated support for this will be considered by the AWS team: You are probably aware that one can't set a dynamic Expires: ... value as such because The only value valid in an Expires header is a HTTP date; anything else ...


6

Section 14.30 of the HTTP 1.1 RFC http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 is not significantly different. I don't know that you're going to see any actual practical limitations for this. The only time I've seen even a warning about this issue is when I used to test in Lynx and the location was not absolute it would warn you "Location ...


6

"Is there a common way to override the server headers send to the browser from within the HTML document?" AFAIK no, you do what you can do already. The defined charset via Header trumps your definition in the META tag. If you have access to the server, e.g. Apache, it is configured by this statement (see the comment lines): # Read the documentation before ...


6

This isn't so much an SEO issue, as an issue as to whether your site would work at all. If it doesn't work in the browser then it's certainly going to hurt your SEO. Your HTML pages still need to return the text/html mime-type in order to be interpreted as HTML by the browser. ie. You need to send a Content-Type: text/html HTTP response header somehow. ...


5

It is a request-response conversation, so the client sends a request of "Content-Type" and expects to receive the response of "Accept" media type.


5

You're correct. RED implemented the requirements from HTTPbis http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-18#section-4.1. Normally, HTTPbis requirements are backwards-compatible with RFC2616 (i.e., they don't make implementations that were conformant to 2616 non-conformance now), but this change slipped through -- we'll be opening an issue ...


5

What you want is the immutable keyword in your Cache-Control line. Example for php: header('Cache-Control: public, max-age=80000, immutable'); Source: https://code.facebook.com/posts/557147474482256/this-browser-tweak-saved-60-of-requests-to-facebook/


5

John Conde's suggestion of returning an HTTP 410 Gone status code is good, but, depending on the circumstances, a plain old HTTP 404 Not Found might be more appropriate. Specifically, the HTTP 410 status code is intended to signal that the resource has been deliberately and permanently deleted, is not expected to return, and that links to it should be ...


5

The s-maxage header is intended for proxies, while max-age is intended for regular users. A typical end user (not using a proxy) would have the file cached for a year. The same should be the case for someone using a proxy as well, since the proxy will likely send the file unmodified, i.e. including the max-age header. But the proxy itself would only cache ...


5

Some search engines and bots send HEAD request to pages before sending the GET request for reasons like: Checking if the page size has changed Checking the last modified date etc. (Any other info the head would give them!) This would help large crawlers save a lot of bandwidth if they know a page has not been changed meanwhile and they don't have to crawl ...


5

The reason is that your directive in the X-Robots-Tag is for indexation, not crawling. [EDIT] Explicit reference to this point is made here: https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag This document details how Google handles the page-level indexing settings allow you to control how Google makes content available ...


5

Google considers redirecting content that is no longer available to be "soft 404". They would like to be able to treat the page the same as a 404 page. If you redirect the expired page to your home page, Google will identify it as a soft 404. It will appear in Google Webmaster Tools as an error. Google won't pass the link juice from inbound links to ...


5

Well aren't you friendly... "Hey Google, I'm having a DOS, but im making it your problem, thanks" First: There is no difference for you between serving an 301 or an 404 error page. Your server will have to do the same amount of work. The difference here is that you, with your 301->google solution, now ALSO make it Google's problem, effectively doubling ...


4

Remove all white space (spaces and carriage returns) before any opening <?php or <? tags and after all closing ?> tags in all PHP files you've modified.


Only top voted, non community-wiki answers of a minimum length are eligible