Questions tagged [setcookie]

The setcookie function sends an HTTP cookie to a client.

setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.

1196 questions
6
votes
2 answers

Remove duplicate "Set-Cookie" header from PHP response

This is an example script from a larger application, but shows the general process of what I'm trying to do. If I have the following script:
WOUNDEDStevenJones
  • 5,150
  • 6
  • 41
  • 53
6
votes
3 answers

PHP cookie writes on incorrect domain

I have a cookie that I use on my app. It looks like this: +-------+-------+-----------------------+-------+----------+ | Name | Value | Domain | Path | Expires | +-------+-------+-----------------------+-------+----------+ | foo …
maček
  • 76,434
  • 37
  • 167
  • 198
6
votes
3 answers

Create cookie with AngularJS

I tried to use the code below to set cookies: angular.module('myApp').controller('myController', ['$scope', '$http','$cookies', function ($scope, $http, $cookies) { $scope.setMyCookie = function () { $cookies.put('Mykey', 'MyValue'); …
TheBoubou
  • 19,487
  • 54
  • 148
  • 236
6
votes
1 answer

Xdebug set cookie XDEBUG_SESSION too many times

I use remote debug with PhpStorm, xdebug and nginx + php-fpm. Nginx repsond with 502 error code (Bad Gateway) when I pass XDEBUG_SESSION_START=my_ide_key in request GET parameter. At the same time my code breakpoints in IDE work fine. When I don't…
Ivan Velichko
  • 6,348
  • 6
  • 44
  • 90
6
votes
2 answers

IE8 not applying cookies across domain appropriately -- only on one machine

I have any interesting problem that has me totally stumped. I have a piece of production code that I built that reads an IBM LTPA token cookie set by a machine managed by another dept, validates it, and uses it to log into a system my group manages…
Ethan J. Brown
  • 2,308
  • 3
  • 20
  • 27
5
votes
1 answer

How can I set a cookie's expiration in NodeJS?

I'm writing my own cookies as part of a webserver I'm making using NodeJS (i.e. not using any packages). I've been able to do this just fine using something like: response.writeHead(200, { 'Set-Cookie':'sesh=wakadoo' }); However, I'd like to make…
thisissami
  • 15,445
  • 16
  • 47
  • 74
5
votes
3 answers

Set-Cookie not working properly in axios call

Explanation here, I sent one get req to ABC.com/Users/Login using Axios after this I sent a post request to ABC.com/Users/Login with form data and Cookie. but it does not work properly. It works properly in postmen My…
Kaushal Gajjar
  • 51
  • 1
  • 1
  • 3
5
votes
1 answer

AWS Lambda Set-Cookie header not setting in the browser

I'm trying to set a cookie in my aws lambda function response. I don't have any header mapping as I'm using lambda proxy integration with API Gateway. The response code looks like this in the lambda function: exports.handler = async (event) => { …
Brandon0050
  • 146
  • 1
  • 9
5
votes
1 answer

React App + Spring Boot - JWT auth token inside a cookie is not set in Chrome

I'm trying to configure Spring Boot to set-cookie containing JWT auth token following a sign-in request from my react app, and then the expectation is that the browser will automatically set this cookie to all requests as specified by the cookie…
Anton Belev
  • 11,963
  • 22
  • 70
  • 111
5
votes
0 answers

Cookies works in Postman , but not in browser

I created a login API using Django rest framework and then used session auth. When i sent request via Postman , i get csrftoken and sessionid cookies. and i was able to access content on backend. OK fine. But when i built small login form html and…
beg_dev
  • 93
  • 7
5
votes
1 answer

Why no `Set-Cookie` headers in response?

I found sometimes browser can't get cookies from my website, so I use curl to check the headers, and the information is: C:\Documents and Settings\jack>curl http://localhost -I HTTP/1.1 200 OK Expires: Thu, 01-Jan-1970 00:00:00 GMT Set-Cookie:…
Freewind
  • 193,756
  • 157
  • 432
  • 708
5
votes
2 answers

Set a cookie to the entire domain from a page inside a folder

I'm a begginer in cookies and stuff like that. I need to set a cookie to the entire domain from a page inside a folder like mydomain.com/folder/page.php. I had to do this before and I got it done redirecting to another page mydomain.com/another.php…
SPL_Splinter
  • 483
  • 1
  • 5
  • 16
5
votes
1 answer

IE8 not saving cookie values?

I'm having some problems with IE8 respecting a cookie I'm setting via the jQuery cookie plugin. Things are working fine in Firefox, Chrome, Safari, IE6 and IE7 (via IETester), but IE8 just doesn't seem to be storing the cookie. If I F12 to the dev…
magenta placenta
  • 295
  • 1
  • 4
  • 10
5
votes
1 answer

HTTP Redirect (302) Doesn't Use Cookie in Following GET Request

Here is a question I have been researching for some time now. I have a redirect that does not seem to be respecting a Set-Cookie attribute in a 302 Redirect. Here are the request and response headers that I used wireshark to obtain. HTTP/1.1 302…
Sierpwnski
  • 53
  • 1
  • 1
  • 3
5
votes
2 answers

Set a cookie to save login details PHP

I have a typical login (username, password) and also want to include a 'save my details' check box. The login form Posts its values to login_script.php and if the login is successful, the user is redirected to the main page of the site. I'm tying to…
Samuel Meddows
  • 36,162
  • 12
  • 38
  • 36