-
Notifications
You must be signed in to change notification settings - Fork 710
feat: add --proxy flag for browser proxy configuration #16
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
Add CLI flag to configure HTTP/SOCKS proxy for Playwright browser context. Supports URL format with optional credentials: http://user:pass@host:port
|
@nmwcode is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
- Handle malformed credentials (@ without :) by ignoring incomplete creds - Replace unwrap() with expect() for better error messages - Addresses Vercel bot code review suggestions
|
Thanks for adding proxy support - this is a useful feature! A few things to address:
As the bot mentioned, username-only proxies silently drop the username: For http://username@host:port, this returns just
The parse_proxy() function should have unit tests covering:
Add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Suggestions:
- The --proxy flag is not documented in the help output, preventing users from discovering this feature
- The default_flags() test helper function is missing the proxy field, causing compilation errors when tests are run because the Flags struct now requires this field to be initialized
Integra 16 commits del repo oficial upstream incluyendo: - Nuevas features: soporte CDP, headers custom, extensions, screencast - Mejoras: mejor manejo de errores, documentación - Fixes: builds, issues varios Resuelve conflictos manteniendo compatibilidad con cambios locales.
- Agrega soporte para variable de entorno AGENT_BROWSER_HOME en connection.rs - Aumenta timeout por defecto de 10s a 60s para conexiones más lentas
Implements proxy support based on PR vercel-labs#16 with reviewer feedback: Features: - Parse proxy URLs: http://[user:pass@]host:port - Support for HTTP, HTTPS, and SOCKS5 protocols - Handle username-only auth (preserves username with empty password) - Apply proxy to both standard and persistent contexts Changes: - cli/src/flags.rs: Add proxy flag parsing - cli/src/main.rs: Add parse_proxy() with comprehensive tests - cli/src/output.rs: Add --proxy to help output - cli/src/commands.rs: Fix test helper to include proxy field - src/types.ts: Add proxy to LaunchCommand interface - src/protocol.ts: Add proxy validation schema - src/browser.ts: Apply proxy to context creation Tests: - 7 unit tests for parse_proxy() covering all edge cases - All Rust tests passing (69 tests) - All TypeScript tests passing (168 tests) - TypeScript typecheck passing Resolves feedback from PR vercel-labs#16: - Fixed username-only proxy handling (issue #2681046975) - Added comprehensive unit tests - Added --proxy to help documentation - Used expect() instead of unwrap() for better error messages
- Remove redundant comments - Extract server variable to reduce duplication - Inline trivial username/password variables All 7 proxy tests still passing.
|
@ctate done! |
|
Pulled this down, proxy flag works as expected. Nice addition. |
Merged upstream features: - Video recording with Playwright native video (vercel-labs#116) - Proxy support with --proxy flag (vercel-labs#16) - --version flag (vercel-labs#94) - v0.5.0 updates Preserved our customizations: - patchright-core via browser-engine.js abstraction - Persistent context with launchPersistentContext - System Chrome profile support (AGENT_BROWSER_USER_DATA_DIR) - Navigation delay for rate limiting - Stealth scripts - Force headed mode for OAuth - --channel and --bundled flags Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Adds a
--proxyflag to route all browser traffic through a proxy server.Changes
--proxyflag parsing in CLI (Rust)Usage
Supports HTTP, HTTPS, and SOCKS5 protocols.
Background
Playwright requires proxy configuration at context creation time and does not respect HTTP_PROXY/HTTPS_PROXY environment variables.
Testing
Tested with authenticated and unauthenticated proxies. Verified IP changes using httpbin.org/ip.