5

Logging with an HTTP Proxy

 3 years ago
source link: https://willschenk.com/articles/2021/logging_with_an_http_proxy/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Logging with an HTTP Proxy

Will Schenk

Articles Contact Tags

Logging with an HTTP Proxy

Simple MITM debugging

Published January 22, 2021 #javascript, #logging, #proxy, #debugging

I miss having Chrome dev tools when writing node applications, since I often want to see what exactly the network traffic. Here's a way to easily setup a man in the middle proxy to look at all the traffic your application is generating.

Run the docker instance

First we first up the proxy with the web interface:

  docker run --rm -it -p 8080:8080 -p 8081:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0

Node ENV Variables

Then we set the proxy environment variable, and for node specifically, tell it to not worry about self-signed certificates:

  export HTTP_PROXY=http://localhost:8080
  export NODE_TLS_REJECT_UNAUTHORIZED='0'

Then we run our script:

  node outdated.js

Then go visit http://localhost:8081 to see all of the requests that were made.

Simple and easy.

See also

Simple CORS workaround for local development

I've been doing a lot of web development old school, just editing HTML and JavaScript by hand without a build environment. Running npx live-server is an easy one liner to spin up a server, that opens a browser for you and also updates changes on safe. Sometimes that's not enough. Often you want to pull in data from an API, and that requires HTTPS, and also you need to work around CORS limitations.

Read more

Beginning Emacs

Rediscovering emacs

Intro I've been dipping back ito the world of free software, and have been having a huge amount of fun getting back into emacs. I'm using it more of an operating system than I ever did before, as a way to navigate the world using a text interface. I'd never thought I'd be done with the terminal, but this is the first time that I've got something better and more powerful.

Read more

Made in Brooklyn, NY.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK