Share cookies between subdomain and domain

If you set a cookie like this: Set-Cookie: name=value then the cookie will only apply to the request domain, and will only be sent for requests to the exact same domain, not any other subdomains. (See What is a host only cookie?) Two different domains (e.g. and, or and can only … Read more

Python – Requests, Selenium – passing cookies while logging in

I finally found out what the problem was. Before making the post request with the requests library, I should have passed the cookies of the browser first. The code is as follows: import requests from selenium import webdriver driver = webdriver.Firefox() url = “some_url” #a redirect to a login page occurs driver.get(url) #storing the cookies … Read more

Same-Site flag for session cookie in Spring Security

New Tomcat version support SameSite cookies via TomcatContextCustomizer. So you should only customize tomcat CookieProcessor, e.g. for Spring Boot: @Configuration public class MvcConfiguration implements WebMvcConfigurer { @Bean public TomcatContextCustomizer sameSiteCookiesConfig() { return context -> { final Rfc6265CookieProcessor cookieProcessor = new Rfc6265CookieProcessor(); cookieProcessor.setSameSiteCookies(SameSiteCookies.NONE.getValue()); context.setCookieProcessor(cookieProcessor); }; } } For SameSiteCookies.NONE be aware, that cookies are also Secure … Read more

How cookies work?

Understanding Cookies Cookies are given to a browser by the server. The browser reveals the cookies as applicable only to the domain that provided the cookie in the first place. The data in the cookie allows the server to continue a conversation, so to speak. Without the cookie, the server considers the browser a first-time … Read more

Can two different browser share one cookie?

You can build a cookie-proxy by creating a Flash application and use Shared Objects (SO = Flash cookies) to store data. Any Browsers with Flash installed could retrieve the informations stored in the SO. But, it’s an ugly workaround. Just don’t share cookies… and find another way to build your website/app.

I want to store Javascript array as a Cookie

JSON encode it, effectively producing a string like “{name:’myname’,age:’myage’}” which you put in a cookie, retrieve when needed and decode back into a JavaScript array/object. Example – store array in a cookie: var arr = [‘foo’, ‘bar’, ‘baz’]; var json_str = JSON.stringify(arr); createCookie(‘mycookie’, json_str); Later on, to retrieve the cookie’s contents as an array: var … Read more

How to Delete Session Cookie?

A session cookie is just a normal cookie without an expiration date. Those are handled by the browser to be valid until the window is closed or program is quit. But if the cookie is a httpOnly cookie (a cookie with the httpOnly parameter set), you cannot read, change or delete it from outside of … Read more