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
3723
votes
31 answers

How do I POST JSON data with cURL?

I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am trying to post a JSON data. Example data is like…
kamaci
  • 72,915
  • 69
  • 228
  • 366
3534
votes
22 answers

403 Forbidden vs 401 Unauthorized HTTP responses

For a web page that exists, but for which a user does not have sufficient privileges (they are not logged in or do not belong to the proper user group), what is the proper HTTP response to serve? 401 Unauthorized? 403 Forbidden? Something else? What…
1948
votes
11 answers

How to send a header using a HTTP request through a cURL call?

I wish to send a header to my Apache server on a Linux box. How can I achieve this via a cURL call?
gagneet
  • 35,729
  • 29
  • 78
  • 113
1870
votes
29 answers

How do we control web page caching, across all browsers?

Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner. For security reasons we do not want certain pages in our application to be cached, ever, by the web browser. This must work for at least…
Edward Wilde
  • 25,967
  • 8
  • 55
  • 64
1848
votes
9 answers

What does enctype='multipart/form-data' mean?

What does enctype='multipart/form-data' mean in an HTML form and when should we use it?
EBAG
  • 21,625
  • 14
  • 59
  • 93
1625
votes
7 answers

application/x-www-form-urlencoded or multipart/form-data?

In HTTP there are two ways to POST data: application/x-www-form-urlencoded and multipart/form-data. I understand that most browsers are only able to upload files if multipart/form-data is used. Is there any additional guidance when to use one of the…
max
  • 29,122
  • 12
  • 52
  • 79
1507
votes
6 answers

Custom HTTP headers : naming conventions

Several of our users have asked us to include data relative to their account in the HTTP headers of requests we send them, or even responses they get from our API. What is the general convention to add custom HTTP headers, in terms of naming,…
Julien Genestoux
  • 31,046
  • 20
  • 66
  • 93
1462
votes
3 answers

Proper MIME media type for PDF files

When working with PDFs, I've run across the MIME types application/pdf and application/x-pdf among others. Is there a difference between these two types, and if so what is it? Is one preferred over the other? I'm working on a web app which must…
friedo
  • 65,762
  • 16
  • 114
  • 184
971
votes
7 answers

Are HTTP headers case-sensitive?

In a blog post I use the following PHP to set the content-type of a response: header('content-type: application/json; charset=utf-8'); I just got a comment on that post saying that content-type needs to be capitalized, Content-type. Is this…
Svish
  • 152,914
  • 173
  • 462
  • 620
726
votes
9 answers

What's the difference between Cache-Control: max-age=0 and no-cache?

The header Cache-Control: max-age=0 implies that the content is considered stale (and must be re-fetched) immediately, which is in effect the same thing as Cache-Control: no-cache.
rubyruy
  • 7,752
  • 3
  • 19
  • 15
718
votes
9 answers

Getting only response header from HTTP POST using cURL

One can request only the headers using HTTP HEAD, as option -I in curl(1). $ curl -I / Lengthy HTML response bodies are a pain to get in command-line, so I'd like to get only the header as feedback for my POST requests. However, HEAD and POST are…
Jonathan Allard
  • 18,429
  • 11
  • 54
  • 75
620
votes
22 answers

How to encode the filename parameter of Content-Disposition header in HTTP?

Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form: Content-Disposition: attachment; filename=FILENAME The filename…
Atif Aziz
  • 36,108
  • 16
  • 64
  • 74
612
votes
9 answers

How can I view HTTP headers in Google Chrome?

Till 9.x, the headers were under the resources in the Developer Tools, but now I can't find it anywhere.
user267817
599
votes
5 answers

What MIME type should I use for CSV?

I've seen application/csv used and also text/csv. Is there a difference? Does it matter which as long as the request matches something that's available? Are they interchangeable?
Steve Dunn
  • 21,044
  • 11
  • 62
  • 87
594
votes
1 answer

Do I need Content-Type: application/octet-stream for file download?

The HTTP standard says: If this header [Content-Disposition: attachment] is used in a response with the application/octet-stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a…
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
1
2 3
99 100