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
486
votes
18 answers

Accessing the web page's HTTP Headers in JavaScript

How do I access a page's HTTP response headers via JavaScript? Related to this question, which was modified to ask about accessing two specific HTTP headers. Related: How do I access the HTTP request header fields via JavaScript?
keparo
  • 33,450
  • 13
  • 60
  • 66
468
votes
36 answers

"CAUTION: provisional headers are shown" in Chrome debugger

I noticed a strange caution message when looking at downloaded resources using Google chrome inspector (F12): Caution provisional headers are shown I found something possibly relevant, Network Panel: add caution about provisional request headers,…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
452
votes
8 answers

Access Control Request Headers, is added to header in AJAX request with jQuery

I would like to add a custom header to an AJAX POST request from jQuery. I have tried this: $.ajax({ type: 'POST', url: url, headers: { "My-First-Header":"first value", "My-Second-Header":"second value" } //OR …
fingerup
  • 4,828
  • 2
  • 16
  • 22
451
votes
3 answers

What is http multipart request?

I have been writing iPhone applications for some time now, sending data to server, receiving data (via HTTP protocol), without thinking too much about it. Mostly I am theoretically familiar with process, but the part I am not so familiar is HTTP…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
449
votes
4 answers

What are all the possible values for HTTP "Content-Type" header?

I have to validate the Content-Type header value before passing it to an HTTP request. Is there a specific list for all the possible values of Content-Type? Otherwise, is there a way to validate the content type before using it in an HTTP request?
Awesome
  • 5,689
  • 8
  • 33
  • 58
414
votes
7 answers

Maximum on HTTP header values?

Is there an accepted maximum allowed size for HTTP headers? If so, what is it? If not, is this something that's server specific or is the accepted standard to allow headers of any size?
Cory
  • 22,772
  • 19
  • 94
  • 91
407
votes
14 answers

Why would one omit the close tag?

I keep reading it is poor practice to use the PHP close tag ?> at the end of the file. The header problem seems irrelevant in the following context (and this is the only good argument so far): Modern versions of PHP set the output_buffering flag…
johnlemon
  • 20,761
  • 42
  • 119
  • 178
375
votes
8 answers

What is "X-Content-Type-Options=nosniff"?

I am doing some penetration testing on my localhost with OWASP ZAP, and it keeps reporting this message: The Anti-MIME-Sniffing header X-Content-Type-Options was not set to 'nosniff' This check is specific to Internet Explorer 8 and Google…
Pringles
  • 4,355
  • 3
  • 18
  • 19
365
votes
9 answers

How can I add a custom HTTP header to ajax request with js or jQuery?

Does anyone know how to add or create a custom HTTP header using JavaScript or jQuery?
Txugo
  • 5,008
  • 5
  • 33
  • 40
350
votes
9 answers

What's the "Content-Length" field in HTTP header?

What does it mean? Byte count of encoded content string with encoding specified in header. Character count of content string. Especially in case of Content-Type: application/x-www-form-urlencoded.
eonil
  • 83,476
  • 81
  • 317
  • 516
348
votes
16 answers

How do I read any request header in PHP?

How should I read any header in PHP? For example the custom header: X-Requested-With.
Sabya
  • 11,534
  • 17
  • 67
  • 94
348
votes
7 answers

How to set HTTP header to UTF-8 using PHP which is valid in W3C validator

I have several PHP pages echoing out various things into HTML pages with the following code. However, when I validate using the W3C validator it comes up with: The character…
manycheese
  • 3,605
  • 2
  • 18
  • 11
348
votes
2 answers

How does Content Security Policy (CSP) work?

I'm getting a bunch of errors in the developer console: Refused to evaluate a string Refused to execute inline script because it violates the following Content Security Policy directive Refused to load the script Refused to load the…
Schlaus
  • 18,144
  • 10
  • 36
  • 64
346
votes
2 answers

Best HTTP Authorization header type for JWT

I'm wondering what is the best appropriate Authorization HTTP header type for JWT tokens. One of the probably most popular type is Basic. For instance: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== It handle two parameters such as a login and a…
Zag zag..
  • 6,041
  • 6
  • 27
  • 36
337
votes
9 answers

Returning a file to View/Download in ASP.NET MVC

I'm encountering a problem sending files stored in a database back to the user in ASP.NET MVC. What I want is a view listing two links, one to view the file and let the mimetype sent to the browser determine how it should be handled, and the other…
Nick Albrecht
  • 16,607
  • 10
  • 66
  • 101