Cookies Set on Wrong Domain When Redirects Disabled
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
When a request (with `Follow redirects` _disabled_) to `originaldomain.com` results in a response with
```
Location: otherdomain.com
Set-Cookie: foo=bar
```
I expect the `foo=bar` cookie is set with domain `originaldomain.com`.
### Actual Behavior
When a request (with `Follow redirects` _disabled_) to `originaldomain.com` results in a response with
```
Location: otherdomain.com
Set-Cookie: foo=bar
```
The `foo=bar` cookie is being set with domain `otherdomain.com` instead of `originaldomain.com`.
When `Follow redirects` is _enabled_, this works as expected.
### Reproduction Steps
1. Disable `Follow redirects` in Insomnia preferences
2. Visit a site that returns a 307 response with a `location` header of a different domain and a `set-cookie` header without a `domain` attribute (my test endpoints do not include a `domain` attribute in the cookie response so maybe that is related, I have not tested when a `domain` is included)
3. Observe that cookie in insomnia is linked to the domain in the `location` header instead of the original requested domain, which returned the `set-cookie` header
### Is there an existing issue for this?
- [x] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Which sync method do you use?
- [ ] Git sync.
- [ ] Insomnia Cloud sync.
- [x] Local only
### Additional Information
When `Follow redirects` is enabled the cookie is set correctly on the original domain.
This is somewhat similar to https://github.com/Kong/insomnia/issues/6478 but that is about when `Follow redirects` is enabled and a cookie is set by the _second_ domain. This is about when `Follow redirects` is _disabled_ and the _original_ domain attempts to set a cookie.
Originally found issue on version 2023.5.8 of Insomnia, upgraded to 10.3.1 hoping it was fixed, but it is not.
### Insomnia Version
10.3.1
### What operating system are you using?
Windows
### Operating System Version
Windows 11 Version 22H2
### Installation method
download from insomnia.rest
### Last Known Working Insomnia version
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.