-
Notifications
You must be signed in to change notification settings - Fork 71
feat: Add bindAddress command line option to allow local-ssl-proxy to play nice with WSL #124
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
base: main
Are you sure you want to change the base?
Conversation
…oxy to play nice with WSL
|
| "devDependencies": { | ||
| "@tsconfig/node-lts-strictest": "^18.12.1", | ||
| "@types/http-proxy": "^1.17.10", | ||
| "@types/http-proxy": "1.17.15", |
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.
v1.17.10 didn't include the hostname parameter on the .listen method, hence the update.
| import { isProxy, isConfig, parse, ParsedArguments, Proxy, Config } from '../src/lib'; | ||
|
|
||
|
|
||
| function expectProxy(result: ParsedArguments): Proxy { |
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.
Type guard functions to keep TypeScript happy on the tests.
After changing ParsedArguments to export type ParsedArguments = (Proxy | Config) & BindAddress; to include bindAddress, TypeScript was unable to infer the correct type from the return of the call to parse
| export type ParsedArguments = (Proxy | Config) & BindAddress; | ||
|
|
||
| function isConfig(args: unknown): args is Config { | ||
| export function isConfig(args: unknown): args is Config { |
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.
Exported so it can be used in unit-tests
Running local ssl proxies under WSL requires a hostname param
0.0.0.0to be passed to thelistenmethod for the proxy to work on the Windows browser, eg:Note that adding this hostname has no effect on users not unnning under WSL.
This PR adds a
--bindAddresscommand line option that is respected both when passing a proxy through args, and when using a config file.bindAddresscannot be passed through the config file itself, as it is not a proxy-specific argument and would have required changing the structure of the config file, which didn't seem wise.