http-headers interview questions
Top http-headers frequently asked interview questions
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
.
Google has failed to solve this mystery for me :(
Source: (StackOverflow)
For a web page that exists, but for which a user that 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? 403? Something else? What I've read on each so far isn't very clear on the difference between the two. What use cases are appropriate for each response?
Source: (StackOverflow)
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 deliver huge amounts of PDFs and I want to do it the correct way, if there is one.
Source: (StackOverflow)
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 cached, ever, by the web browser. This must work for at least the following browsers:
- Internet Explorer 6+
- Firefox 1.5+
- Safari 3+
- Opera 9+
- Chrome
Our requirement came from a security test. After logging out from our website you could press the back button and view cached pages.
Source: (StackOverflow)
I wish to send a header to my Apache server on a Linux box. How can I achieve this via a curl call?
Source: (StackOverflow)
I am running a server on nodejs with express. I can't seem to get rid of the header:
X-Powered-By:Express
I was wondering if there is any way to get rid of this header or do I have to live with it?
Source: (StackOverflow)
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".
Source: (StackOverflow)
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
//beforeSend: function(xhr) {
// xhr.setRequestHeader("My-First-Header", "first value");
// xhr.setRequestHeader("My-Second-Header", "second value");
//}
}).done(function(data) {
alert(data);
});
When I send this request and I watch with FireBug, I see this header:
OPTIONS xxxx/yyyy HTTP/1.1
Host: 127.0.0.1:6666
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Origin: null
Access-Control-Request-Method: POST
Access-Control-Request-Headers: my-first-header,my-second-header
Pragma: no-cache
Cache-Control: no-cache
Why do my custom headers go to Access-Control-Request-Headers
:
Access-Control-Request-Headers: my-first-header,my-second-header
I was expecting a header values like this:
My-First-Header: first value
My-Second-Header: second value
Is it possible? Thanks.
Source: (StackOverflow)
What is the difference between these headers?
Content-Type: application/javascript
Content-Type: application/x-javascript
Content-Type: text/javascript
Which one is best and why?
Please do not say they are identical - if they were identical there would not have been two of them. I know both work - but I would like to know the difference.
Source: (StackOverflow)
What are the differences between
Response.AddHeader("Content-Disposition", "attachment;filename=somefile.ext")
and
Response.AddHeader("Content-Disposition", "inline;filename=somefile.ext")
I don't know the differences , because when I use one or another I always get a window prompt asking me to download the file for both of them. I read the specs, but it is clueless.
Source: (StackOverflow)
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?
Source: (StackOverflow)