http-headers

Passing JWT in headers with axios

妖精的绣舞 提交于 2019-12-20 10:29:59
问题 I've created a small project with a node back-end and react front-end to fetch the data through REST calls i used Axios library. But when i pass the headers with it I keep getting an error saying Failed to load resource: the server responded with a status of 401 (Unauthorized) . I found out two methods and both did not work. They are export const getUsersDetails=()=>{ console.log('calling'); return (dispatch) => { return axios.get('http://localhost:3030/users',{headers: { "Authorization":

What is the Pragma Header? Caching pages.. and IE

六月ゝ 毕业季﹏ 提交于 2019-12-20 09:45:42
问题 So I am sending a header in php to cache my page (this integrates into our "CDN" (contendo/akamai) as well). I always use this pragma: cache header, I've seen various examples use it as well; however, I just checked fiddler to test traffic for this .net application we developed and it says: Legacy Pragma Header is present: cache !! Warning IE supports only an EXACT match of "Pragma: no-cache". IE will ignore the Pragma header if any other values are present. ... I suppose that is ok. The rest

What is the correct response to an HTTP POST request?

蹲街弑〆低调 提交于 2019-12-20 08:48:46
问题 For a POST method, the W3 specs say: If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see Section 10.4). http://www.ietf.org/internet-drafts/draft-ietf-httpbis-p2-semantics-05.txt (section 8.5) The standard response actually seems to be to send a Redirect to the newly created resource. I'm building my site with ASP.NET MVC, and tried

how to remove X-Powered-By in ExpressJS [duplicate]

自古美人都是妖i 提交于 2019-12-20 08:35:14
问题 This question already has answers here : Can't get rid of header X-Powered-By:Express (9 answers) Closed 5 years ago . I want to remove X-Powered-By for Security,Save Bandwidth in ExpressJS(node.js). how to do it? it could be filter(app.use) ? app.use(function(req,res,next_cb){ /* remove X-Powered-By header */ next_cb(); } 回答1: The better way to do it is: app.disable('x-powered-by'); You can also make a middleware to remove any header like so: app.use(function (req, res, next) { res

What does the HTTP header If-None-Match: * mean?

瘦欲@ 提交于 2019-12-20 08:27:24
问题 What does the following HTTP 1.1 header mean? If-None-Match: * I understand it when using a strong or weak ETag or even a list of ETags, but I don't understant it's use when using star (*). Edit: Would be nice to have some pseudocode (PHP code good also) that would show how/what to answer to "If-None-Match: *". 回答1: The answer is: it depends. Suppose we have received If-None-Match: * If-Modified-Since: <yesterday date> And the page has been altered today . First, we take a look at the * which

Why two requests when I download a file? [closed]

感情迁移 提交于 2019-12-20 04:26:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have an action which serves a file: public override FileContentResult Foo() { var someDataAsBytes = ... return File(someDataAsBytes, "text/csv", "somefilename.csv"); } The form is simple: <form method="get" action="/Foo" id="myForm"> <button type="submit">Download</button> </form> I initiate the download via

What encoding to use when interpreting HTTP/1.1 header field value

佐手、 提交于 2019-12-20 04:22:11
问题 In HTTP/1.1 specs I get this when it comes to define headers: message-header = field-name ":" [ field-value ] [...] field-value = *( field-content | LWS ) field-contet = <the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, separators, and quoted-string> and the definition for OCTET and TEXT is: OCTET = <any 8-bit sequence of data> TEXT = <any OCTET except CTLs, but including LWS> ; where CTL refers to control characters from US-ASCII charset. Question

What encoding to use when interpreting HTTP/1.1 header field value

ぐ巨炮叔叔 提交于 2019-12-20 04:22:11
问题 In HTTP/1.1 specs I get this when it comes to define headers: message-header = field-name ":" [ field-value ] [...] field-value = *( field-content | LWS ) field-contet = <the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, separators, and quoted-string> and the definition for OCTET and TEXT is: OCTET = <any 8-bit sequence of data> TEXT = <any OCTET except CTLs, but including LWS> ; where CTL refers to control characters from US-ASCII charset. Question

HTTP request from javascript using raw message including headers

左心房为你撑大大i 提交于 2019-12-20 03:03:37
问题 I know how to make an HTTP request to my REST api from javascript using jQuery or XMLHttpRequest. What I want to do now is make the request without setting properties for the header values. An HTTP request message consists of: Request line, such as GET /images/logo.png HTTP/1.1, which requests a resource called /images/logo.png from server Headers, such as Accept-Language: en An empty line An optional message body A request to my api should look something like this: GET /myapi/myresource/1234

How to implement 303 redirect?

那年仲夏 提交于 2019-12-20 02:48:34
问题 I'd like to know how to implement 303 redirect for displaying post data. Example: I send the form. Redirect Page displays the info I just posted. (Eg: Name, email). I think it is done with parameters, like /index.php?name=TheName&email=theEmail but i'm not sure, since I've tried to find some good article explaining it but couldn't. Thanks a lot. 回答1: In PHP you can perform a 303 redirect using header() : header("HTTP/1.1 303 See Other"); header("Location: http://$_SERVER['HTTP_HOST']/new