8000 Fix/concurrent mitmweb instances overwrite each others mitmproxy auth cookie by turboOrange · Pull Request #7690 · mitmproxy/mitmproxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix/concurrent mitmweb instances overwrite each others mitmproxy auth cookie #7690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

turboOrange
Copy link
Contributor
@turboOrange turboOrange commented May 4, 2025

Description

This is a fix for #7651.
The issue was that when two instances were running from the same domain or IP address, they shared cookies because cookies are tied to the domain, not the port. This made it difficult to run multiple instances on the same machine.

The solution proposed in this pull request is to include the port number in the cookie name. This ensures that even if cookies are technically shared at the domain level, they remain distinct and do not conflict.

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

@turboOrange turboOrange requested a review from injust May 5, 2025 02:16
@injust
Copy link
Contributor
injust commented May 5, 2025

LGTM aside from some nitpicks.

Putting the port in the cookie name isn't my idea of an elegant solution, but it's probably the best way to solve #7651.

@turboOrange
Copy link
Contributor Author

LGTM aside from some nitpicks.

Putting the port in the cookie name isn't my idea of an elegant solution, but it's probably the best way to solve #7651.

I agree. Even if it's common to use a web page as UI for local tools, the technology is not really made for that so I think it's normal to need some workarounds. For that specific tool, I can really see the appeal of having more then one running. I just can't think of a cleaner solution.

@turboOrange turboOrange requested a review from injust May 5, 2025 03:11
@turboOrange
Copy link
Contributor Author

LGTM aside from some nitpicks.
Putting the port in the cookie name isn't my idea of an elegant solution, but it's probably the best way to solve #7651.

I agree. Even if it's common to use a web page as UI for local tools, the technology is not really made for that so I think it's normal to need some workarounds. For that specific tool, I can really see the appeal of having more then one running. I just can't think of a cleaner solution.

Actually, I lie here. I have an other idea but that would involve giving the proxy an API that the web page would interact with. This way, all the instances would be accessible from the same web page. We would have to use some kind of discovery method to automatically connect the web page to the instances. We could explore that alternative in the future. I don't really know how it would work yet.

Copy link
Member
@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@turboOrange turboOrange requested a review from mhils May 6, 2025 02:12
@mhils mhils force-pushed the fix/concurrent-mitmweb-instances-overwrite-each-others-mitmproxy-auth-cookie branch from 97c21e7 to 2e71fa1 Compare May 22, 2025 17:57
@mhils
Copy link
Member
mhils commented May 22, 2025

@turboOrange: I tried to simplify things a bit. PTAL, this is good to go from my end. :)

@mhils mhils merged commit 790f000 into mitmproxy:main May 24, 2025
27 checks passed
@turboOrange turboOrange deleted the fix/concurrent-mitmweb-instances-overwrite-each-others-mitmproxy-auth-cookie branch May 24, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0