Questions tagged [response-headers]

545 questions
97
votes
3 answers

Express.js - How to check if headers have already been sent?

I am writing a library which may set headers. I want to give a custom error message if headers have already been sent, instead of just letting it fail with the "Can't set headers after they are sent" message given by Node.js. So how to check if…
powerboy
  • 10,523
  • 20
  • 63
  • 93
88
votes
5 answers

Removing/Hiding/Disabling excessive HTTP response headers in Azure/IIS7 without UrlScan

I need to remove excessive headers (primarily to pass penetration testing). I have spent time looking at solutions that involve running UrlScan, but these are cumbersome as UrlScan needs to be installed each time an Azure instance is started. There…
Nick Evans
  • 3,279
  • 2
  • 25
  • 21
82
votes
6 answers

Is header('Content-Type:text/plain'); necessary at all?

I didn't see any difference with or without this head information yet.
omg
  • 136,412
  • 142
  • 288
  • 348
42
votes
8 answers

How can I send back response headers with Node.js / Express?

I'm using res.send and no matter what, it returns status of 200. I want to set that status to different numbers for different responses (Error, etc) This is using express
Shamoon
  • 41,293
  • 91
  • 306
  • 570
40
votes
4 answers

How do delete a HTTP response header?

I have a situation where one of the response headers Content-Disposition has to be removed. So I thought of writing a servlet filter to do this. But I realized that the HttpServletResponse has only a setHeader() method but no method to remove…
Daniel
  • 403
  • 1
  • 4
  • 4
40
votes
7 answers

automatically add header to every response

I want to add this header "Access-Control-Allow-Origin", "*" to every response made to the client whenever a request has made for rest controllers in my application to allow cross origin resource sharing Currently I 'm manually adding this header to…
Mayank Sharma
  • 702
  • 1
  • 9
  • 15
32
votes
1 answer

Axios expose response headers: Content-Disposition

I was able to set request headers to expose Content-Disposition by adding: "Access-Control-Expose-Headers": "Content-Disposition" I can see the response but the response object does not include Content-Disposition. Is there any way i can access…
pranay-91
  • 323
  • 1
  • 3
  • 9
27
votes
2 answers

What is the timespan type of max-age in the HTTP response header? Seconds, minutes?

In the HTTP response header for my website it is returning a header that contains the following value. "Cache-Control: max-age=3600" Is 3600 in seconds or minutes?
Paul Mendoza
  • 5,709
  • 12
  • 53
  • 82
26
votes
8 answers

How do I get the HTTP response status code in AngularJS 1.2

Using ngResource in AngularJS 1.2rc(x), how do I get the status code now? RestAPI.save({resource}, {data}, function( response, responseHeaders ) { }); where RestAPI is my ngResource. The response has the $promise object and the resource returned…
Eddie Monge Jr
  • 12,676
  • 2
  • 19
  • 24
23
votes
3 answers

AngularJS $http response header

This simple problem is bugging me. I have a custom value in my response header from the Web Api Rest server. I can see it it Firebug as: X-TotalPages 204 I try to get it in my AngularJS controller. Code below. But I cant find any good examples how…
Jens Alenius
  • 1,931
  • 2
  • 16
  • 20
19
votes
6 answers

Why can't the "Server" Response Header be removed via web.config in IIS7?

Remove Server Response Header IIS7 I know how to remove the Server response header with an HTTP Module based on the link above. I just want to know why it is necessary to remove it this way.
David Murdoch
  • 87,823
  • 39
  • 148
  • 191
18
votes
1 answer

How to rewrite Location response header in a proxy setup with Apache?

I have a primary proxy which sends requests to a secondary proxy on which OpeenSSO is installed. If the OpenSSO agent determines that the user is not logged in, it raises a 302 redirect to the authentication server and provides the original…
xeonman9000
  • 181
  • 1
  • 1
  • 6
13
votes
2 answers

How to get/set multiple 'Set-Cookie' Headers using Fetch API?

As you might know, RFC 6265 indicates that it is allowed to have multiple headers with the Set-Cookie name. However, Fetch API doesn't allow to do that because all the methods exposed by its Headers interface (including get(), set(), append(),…
Darkseal
  • 9,205
  • 8
  • 78
  • 111
13
votes
1 answer

Clear-Site-Data header error in Chrome console

I'm trying to implement a cache clearing button for our website that will append the Clear-Site-Data header on a specific route so we can be relatively sure that the users are getting the latest javascript, css, etc. after a release. I'm assigning…
Mike Devenney
  • 1,758
  • 1
  • 23
  • 42
11
votes
3 answers

Proper WWW-Authenticate header for OAuth provider

In the OAuth 1.0 spec it is suggested to respond with the following WWW-Authenticate header: WWW-Authenticate: OAuth realm="http://server.example.com/" Is it suitable to add any other informative data to this header? In case a request for a…
Jon Nylander
  • 8,743
  • 5
  • 34
  • 45
1
2 3
36 37