feat: Add bindAddress command line option to allow local-ssl-proxy to play nice with WSL#124
feat: Add bindAddress command line option to allow local-ssl-proxy to play nice with WSL#124spapaseit wants to merge 1 commit intocameronhunter:mainfrom
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.
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.
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.
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.