Earlier quoted context omitted.
At work, whoever designed our setup put the staging and dev environments on the same domain and the entire massive company has adopted this pattern. What a colossal mistake.
For the juniors reading this, here's what you do: Buy a second domain, ideally using the same TLD as your production domain (some firewalls and filters will be prejudiced against specific TLDs). Mimic the subdomains exactly as they are in production for staging/dev.
Handling cookies is a minefield
181–190 of 270 posts
Re: Handling cookies is a minefield
#182One issue we had was the reverse proxy inserting headers about the origin of the request to the server behind. Like ip, ip city lookup etc. And that parsed through a service written in go that just crashed whenever the city had a Norwegians letter in it, took ages to understand why some of our (luckily only internal) services didn't work for coworkers working from Røros for instance. And that was again not the fault of the Go software, but how the stdlib handled it.
Re: Handling cookies is a minefield
#183Earlier quoted context omitted.
For the juniors reading this, here's what you do: Buy a second domain, ideally using the same TLD as your production domain (some firewalls and filters will be prejudiced against specific TLDs). Mimic the subdomains exactly as they are in production for staging/dev.
Just use subdomains such as *.dev.example.com, *.test.example.com, *.prod.example.com, etc., no?
Re: Handling cookies is a minefield
#184Re: Handling cookies is a minefield
#185Earlier quoted context omitted.
Why are first-party cookies bad?
They are not bad they just are unnecessary. If your application uses local state, use local storage. If you store session data on the server, identify the user using the Authorization header. Why send arbitrary strings back and forth often with requests that don’t need them. Plus the technology is clearly rotten. They never got namespacing snd expiration right so you can just do weird stuff with them. Also, CSRF woul…
And by what miracle browser would send Authorization header? Who sets it? For which domain it could be set?
Re: Handling cookies is a minefield
#186Earlier quoted context omitted.
For the juniors reading this, here's what you do: Buy a second domain, ideally using the same TLD as your production domain (some firewalls and filters will be prejudiced against specific TLDs). Mimic the subdomains exactly as they are in production for staging/dev.
Just use subdomains such as *.dev.example.com, *.test.example.com, *.prod.example.com, etc., no?
Re: Handling cookies is a minefield
#187I got the impression that almost as soon as they were introduced people thought the only sensible use of cookies is to set an opaque token so the server can recognize the client when it sees it again, and store everything else server side. I don;t understand why it's a problem that the client (in principle) can handle values that the server will never send. Just don't send them, and you don;t have to worry about perp…
Cookies are an antiquated technology. One of the first introduced while the web was still young in the 90s, and they have had a few iterations of bad ideas. They are the only place to store opaque tokens, so you gotta use them for auth.
Re: Handling cookies is a minefield
#188Earlier quoted context omitted.
How would you use the Authorization header to implement server side session data?
I think they mean storing an identifier in local or session storage and then sending it in the header.
Re: Handling cookies is a minefield
#189Zoom or some other website our customers use was writing a cookie with quotes that would break the site. Amazingly hard to reproduce and debug.
Re: Handling cookies is a minefield
#190Earlier quoted context omitted.
For the juniors reading this, here's what you do: Buy a second domain, ideally using the same TLD as your production domain (some firewalls and filters will be prejudiced against specific TLDs). Mimic the subdomains exactly as they are in production for staging/dev.
Just use subdomains such as *.dev.example.com, *.test.example.com, *.prod.example.com, etc., no?
And if your marketing/SEO/business people are ok with having something like "prod" as a subdomain for all your production web pages.