Skip to content
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

Host/port binding and reverse proxy #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mhnagaoka
Copy link

  • Adds command line configuration options to allow specifying the IP/port to bind to (--proxy-host and --proxy-port);
  • Adds a command line options for activating a reverse proxy mode (i.e. forwards the requests to the same server, --reverse-proxy).

@kdzwinel
Copy link
Owner

Thank you! I'll take a look and merge it on weekend.


You can run Betwixt right away using `npm start`.

### Running with binding options and reverse proxy mode

`npm start -- --proxy-port=8010 --proxy-host=0.0.0.0 --reverse-proxy=http://127.0.0.1:8081`
Copy link
Owner

Choose a reason for hiding this comment

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

these two dashes at the beginning - that's a typo, right?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for taking so much time to answer. :(

Nope, it is not a typo. They're necessary to propagate the command line arguments to electron.

$ npm start -- --proxy-port=8010 --proxy-host=0.0.0.0 --reverse-proxy=http://127.0.0.1:8081

> betwixt@0.0.0 start /home/mau/dev/betwixt
> electron main.js "--proxy-port=8010" "--proxy-host=0.0.0.0" "--reverse-proxy=http://127.0.0.1:8081"

From https://docs.npmjs.com/cli/run-script:

As of npm@2.0.0, you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass all the arguments after the -- directly to your script

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for explanation, I didn't know that!

@kdzwinel
Copy link
Owner

From what I've tested it works great. Please fix mentioned docs typo and I'll merge it.

@mhnagaoka
Copy link
Author

@kdzwinel, not sure if you still want to merge this PR. Anyway, please let me know if you want me to rebase the branch.

@kdzwinel
Copy link
Owner

@mhnagaoka this time it took me a while to get back to you, sorry! The answer is: yes, absolutely! However, since I had to switch to mitm-proxy in order to support HTTPS (#31 - I'll merge it this week) you should rebase against that branch. It might be a bit challenging though (not sure how reverse proxy works with mitm-proxy), so if you won't find time to do it then I'll try.

@Guria
Copy link

Guria commented Aug 9, 2018

Guys, it is 2018 here :)

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