Questions tagged [http-headers]

In the Hypertext Transfer Protocol (HTTP), HTTP header fields contain the operating parameters of an HTTP request or response. With the request or response line (first line of message), they form the message header.

The header fields define various characteristics of the data transfer that is requested, or the data that is provided in the message body.

Header fields start with the field name, terminated with a colon character, followed by the field value. Field names and values may be any application-specific strings, but a core set of fields is standardized by the Internet Engineering Task Force (IETF) in RFC 2616 and other updates and extension documents (e.g. RFC 4229), and are commonly understood by all compliant protocol implementations.

Many parameters may be followed by a quality or 'q' value, giving a weight to use in content negotiation. The HTTP message header is separated from the message body by a blank line.

List of HTTP Header fields

11828 questions
230
votes
4 answers

What's the difference of $host and $http_host in Nginx

In Nginx, what's the difference between variables $host and $http_host.
glarrain
  • 8,031
  • 7
  • 31
  • 44
229
votes
6 answers

Difference between no-cache and must-revalidate for Cache-Control?

From the RFC 2616 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1 no-cache If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful…
Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
225
votes
9 answers

Custom header to HttpClient request

How do I add a custom header to a HttpClient request? I am using PostAsJsonAsync method to post the JSON. The custom header that I would need to be added is "X-Version: 1" This is what I have done so far: using (var client = new HttpClient()) { …
Libin Joseph
  • 7,070
  • 5
  • 29
  • 52
225
votes
20 answers

Create a CSV File for a user in PHP

I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file. I have the e-mailing of the link, MySQL query, etc. covered. How can I, when they click the link, have a pop-up to download a CVS with the record from…
Jason
223
votes
2 answers

What is HTTP "Host" header?

Given that the TCP connection is already established when the HTTP request is sent, the IP address and port are implicitly known -- a TCP connection is an IP + Port. So, why do we need the Host header? Is this only needed for the case where there…
noname7619
  • 3,370
  • 3
  • 21
  • 26
222
votes
8 answers

Is REST DELETE really idempotent?

DELETE is supposed to be idempotent. If I DELETE http://example.com/account/123 it's going to delete the account. If I do it again would I expect a 404, since the account no longer exists? What if I attempt to DELETE an account that has never…
Ben Noland
  • 34,230
  • 18
  • 50
  • 51
221
votes
16 answers

Possible reason for NGINX 499 error codes

I'm getting a lot of 499 NGINX error codes. I see that this is a client side issue. It is not a problem with NGINX or my uWSGI stack. I note the correlation in uWSGI logs when a get a 499. address space usage: 383692800 bytes/365MB} {rss usage:…
Tampa
  • 75,446
  • 119
  • 278
  • 425
220
votes
3 answers

What is q=0.5 in Accept* HTTP headers?

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 What do these q=%f mean?
kolypto
  • 31,774
  • 17
  • 105
  • 99
220
votes
11 answers

How big can a user agent string get?

If you were going to store a user agent in a database, how large would you accomdate for? I found this technet article which recommends keeping UA under 200. It doesn't look like this is defined in the HTTP specification at least not that I found.…
JoshBerke
  • 66,142
  • 25
  • 126
  • 164
216
votes
7 answers

what’s the difference between Expires and Cache-Control headers?

What’s the difference between Expires and Cache-Control headers?
whiterose
  • 4,391
  • 8
  • 24
  • 18
207
votes
3 answers

Difference between Pragma and Cache-Control headers?

I read about Pragma header on Wikipedia which says: "The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh…
saplingPro
  • 20,769
  • 53
  • 137
  • 195
204
votes
12 answers

How to remove ASP.Net MVC Default HTTP Headers?

Each page in an MVC application I'm working with sets these HTTP headers in responses: X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 X-AspNetMvc-Version: 2.0 How do I prevent these from showing?
Paul Fryer
  • 9,268
  • 14
  • 61
  • 93
198
votes
5 answers

In what cases will HTTP_REFERER be empty

I know it's possible to get an empty HTTP_REFERER. Under what circumstances does this happen? If I get an empty one, does it always mean that the user changed it? Is getting an empty one the same as getting a null one? and under what circumstances…
sameold
  • 18,400
  • 21
  • 63
  • 87
194
votes
2 answers

How does "304 Not Modified" work exactly?

How are "304 Not Modified" responses generated? How does a browser determine whether the response to an HTTP request is 304? Is it set by the browser or sent from the server? If sent by the server, how does the server know the data available in…
VenomVendor
  • 15,064
  • 13
  • 65
  • 96
190
votes
3 answers

Why is Cache-Control attribute sent in request header (client to server)?

After reading about the Cache-Control field of the HTTP header, I understand that the Cache-Control field in the HTTP response header (server to client) specifies the directives for the intermediate proxy servers/client browser on how to handle the…
Student
  • 4,481
  • 8
  • 27
  • 32