http-headers

Expires vs max-age, which one takes priority if both are declared in a HTTP response?

十年热恋 提交于 2019-12-18 11:07:18
问题 If a HTTP response that returns both Expires and max-age indications which one is used? Cache-Control: max-age=3600 Expires: Tue, 15 May 2008 07:19:00 GMT Considering that each one refers to a different point in time. 回答1: See this answer: Difference between three .htaccess expire rules If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header , even if the Expires header is more restrictive. This rule allows an origin server to

Create a text file for download on-the-fly

和自甴很熟 提交于 2019-12-18 10:59:53
问题 Update #1 What has been posted below is spot on for getting it to output the file. What it is doing though is outputting the string data followed by the rest of the forms HTML. Is there any way to stop what is put into the file and what is just displayed to the browser. Update #2 Just added exit() and all works fine. Thanks! EOU Hi, I've been looking around and seen a few things similar but not quite fully got the grasp on what I need to do to achieve the task fully. At the moment I have a

Android Volley, duplicate Set-Cookie is overridden

馋奶兔 提交于 2019-12-18 10:52:59
问题 Trying to use Volley lib as a network wrapper for my android application. I have a connection up and running, but the problem is that every time there is multiple "Set-Cookie" headers in the response Volley uses Map that cannot have duplicate keys, and will only store the last Set-cookie header and overwrite the rest. Is there a workaround for this issue? Is there another lib to use? 回答1: I tried overiding classes to fix this but when I had to edit NetworkResponse, I was descending too far

HTTP request header: UserAgent variable

蹲街弑〆低调 提交于 2019-12-18 10:43:02
问题 When sending a HTTP request, IE sends the User-Agent variable to the server. A possible value (as seen by the network debugger): User-Agent: Mozilla /5.0 (Compatible MSIE 9.0;Windows NT 6.1;WOW64; Trident/5.0) My question: How does IE (or any other browser) find out this variable? I'm asking this because when visiting some websites, this variable is different than others and I'd like to trace where the change is coming from. 'Compatibility settings' is one option, but I think there is more to

Github pages, HTTP headers

末鹿安然 提交于 2019-12-18 10:32:38
问题 I serve some of my files from my Github pages account. But when I check my "js" files' headers, I saw following: Last-Modified:Sun, 10 Feb 2013 14:00:46 GMT Expires:Sun, 10 Feb 2013 14:13:23 GMT Cache-Control:max-age=600 This file was commited 14 days ago. But I don't plan these files so frequent. So I need to make much bigger max-age value and change Last-Modified value to last commited date. Is it possible to change headers of Github pages? 回答1: I asked this to Github admins, and they told

Adding http headers in Angular 6

北慕城南 提交于 2019-12-18 07:35:07
问题 Can anyone tell me if this is the correct way to add headers to http requests in Angular 6? When I make the call via SwaggerUI, I can see the headers should be: url -X GET --header 'Accept: application/json' --header 'zumo-api-version: 2.0.0' 'https://myurl/tables/stuff' so I have added the following: let headers: HttpHeaders = new HttpHeaders(); headers = headers.append('HttpHeader1', 'Accept:application/json'); headers = headers.append('HttpHeader2', 'zumo-api-version:2.0.0'); And then the

PHP: get_headers set temporary stream_context

夙愿已清 提交于 2019-12-18 05:57:49
问题 I guess PHP's get_headers does not allow for a context, so I have to change the default stream context to only get the HEAD of a request. This causes some issues with other requests on the page. I can't seem to figure out how to reset the default stream context. I'm trying something like: $default = stream_context_get_default(); //Get default stream context so we can reset it stream_context_set_default( //Only fetch the HEAD array( 'http' => array( 'method' => 'HEAD' ) ) ); $headers = get

Adding headers in ASP.NET MVC 3

让人想犯罪 __ 提交于 2019-12-18 04:41:38
问题 I have a basic ASP.NET MVC 3 app. I have a basic action that looks like the following: [AcceptVerbs(HttpVerbs.Post)] public ActionResult AddItem(string id, string name, string description, string username) { // Do stuff return Json(new { statusCode = 1 }); } I am trying to let someone access this action via a JQuery Mobile app that will be hosted in Phone Gap. I was told that I need to return Access-Control-Allow-Origin: * in my header. However, I'm not sure how to return that in the header.

Http response with no http header

老子叫甜甜 提交于 2019-12-18 04:19:31
问题 I have written a mini-minimalist http server prototype ( heavily inspired by boost asio examples ), and for the moment I haven't put any http header in the server response, only the html string content. Surprisingly it works just fine. In that question the OP wonders about necessary fields in the http response, and one of the comments states that they may not be really important from the server side. I have not tried yet to respond binary image files, or gzip compressed file for the moment,

Is safe to use “X-…” header in a HTTP response?

我与影子孤独终老i 提交于 2019-12-18 03:51:10
问题 I have to pass a meta-information in my HTTP response so I figured out that I could use the response header, for instance "X-MyData: 123456". Is that safe? I mean, there is a possibility that a client proxy remove this header? Thanks! 回答1: A client proxy could do anything it wanted, but in general would not strip any headers. Headers starting with an X- are typically reserved for nonstandard usage (i.e. no future standard will introduce a header starting X-) but a proxy may understand them