All Projects → timmckenzie → har-server

timmckenzie / har-server

Licence: MIT license
Serve responses from a HAR file.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to har-server

json-caching-proxy
Node caching HTTP proxy built on top of express-http-proxy. Persists requests and responses to an in-memory HAR-like data structure based on HAR1.2 . Caches JSON content-type responses by default with the ability to cache an entire site; including content-types describing images. Useful for testing front end code, mocking api, and saving the cac…
Stars: ✭ 31 (+0%)
Mutual labels:  har
nicks-cors-test
Simple HTML & JS Tool to quickly test CORS locally.
Stars: ✭ 68 (+119.35%)
Mutual labels:  https
portless
Easy local domains with superpowers
Stars: ✭ 106 (+241.94%)
Mutual labels:  https
dohjs
DNS over HTTPS client for use in the browser
Stars: ✭ 71 (+129.03%)
Mutual labels:  https
django-template
The ultimate Django template: production ready Django 3.2 with Docker, HTTPS and CI/CD using Github actions ‎️‍🔥
Stars: ✭ 20 (-35.48%)
Mutual labels:  https
templates
基于开源新版签到框架站发布的公共har模板库,仅供示例
Stars: ✭ 306 (+887.1%)
Mutual labels:  har
TLS-Redirection
TLS Redirection
Stars: ✭ 109 (+251.61%)
Mutual labels:  https
node-fetch-har
Generate HAR entries for requests made with node-fetch
Stars: ✭ 23 (-25.81%)
Mutual labels:  har
http-requests
An HTTP client abstraction that provides a common interface to several different client implementations.
Stars: ✭ 22 (-29.03%)
Mutual labels:  https
lolhttp
An HTTP Server and Client library for Scala.
Stars: ✭ 93 (+200%)
Mutual labels:  https
aiotunnel
HTTP tunnel on top of aiohttp and asyncio
Stars: ✭ 29 (-6.45%)
Mutual labels:  https
Human Activity Recognition
A new and computationally cheap method to perform human activity recognition using PoseNet and LSTM. Where we use PoseNet for Preprocessing and LSTM for understand the sequence.
Stars: ✭ 25 (-19.35%)
Mutual labels:  har
docker-nginx-certbot
Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.
Stars: ✭ 367 (+1083.87%)
Mutual labels:  https
GoRAT
GoRAT (Go Remote Access Tool) is an extremely powerful reverse shell, file server, and control plane using HTTPS reverse tunnels as a transport mechanism.
Stars: ✭ 34 (+9.68%)
Mutual labels:  https
seahorse
ELKFH - Elastic, Logstash, Kibana, Filebeat and Honeypot (HTTP, HTTPS, SSH, RDP, VNC, Redis, MySQL, MONGO, SMB, LDAP)
Stars: ✭ 31 (+0%)
Mutual labels:  https
httpit
A rapid http(s) benchmark tool written in Go
Stars: ✭ 156 (+403.23%)
Mutual labels:  https
jmitm
Java版本的mitmproxy,对本地浏览器所有的Http(s)请求和响应进行拦截并「重制」;也可充当轻量级B/S版抓包软件;
Stars: ✭ 19 (-38.71%)
Mutual labels:  https
smokeshow
create temporary websites
Stars: ✭ 24 (-22.58%)
Mutual labels:  https
rpatchur
A customizable, cross-platform patcher for Ragnarok Online clients.
Stars: ✭ 33 (+6.45%)
Mutual labels:  https
net
A small, modern, PSR-7 compatible PSR-17 and PSR-18 network library for PHP, inspired by Go's net package.
Stars: ✭ 16 (-48.39%)
Mutual labels:  https

HAR Server

Build Status

Serve files from a HAR file.

har-server takes a HAR file as an input, and creates a HTTP server which will replay responses from the HAR file.

Install Command

npm install -g har-server

How does it work?

  1. Capture a HAR file with full response bodies. Lets use http://cnn.com, and save HAR as cnn.com.har
  2. Run har-server sudo har-server cnn.com.har -p 80 -h -r
  • -p will set the listening port to 80. You need to run as root to do this
  • -h add all domains in HAR to host file, and point them to 127.0.0.1
  • -r remove all domains which were added to host file, when SIGINT is caught (ctrl+c).
  1. Open your browser, and open http://cnn.com
  • DNS cache might keep requests from cnn.com from coming form har-server
  1. All responses will be a reply from cnn.har.

Serving a resource

A request for a resource is considered to be a match of a HAR file entry if and only if:

  • the HAR host matches the requests host header
  • the HAR path, query string, and fragment exactly matches the request path, query string, and fragment
  • the HAR HTTP method matches the request HTTP method
  • the request body, and HAR request body match If the HAR file contains multiple matches for a specific request the first match is used in the response.

Serving a HTTPS har

har-server can generate its own SSL key and certificate, or use pre-existing ones. However, loading the har file in a browser causes all sorts of SSL errors. har-server uses one key-cert pair for every domain, which causes all browsers display a warning on the page's domain, and reject all 3rd party resources. This is good for security but bad for serving HAR files.

Chrome has a command line switch to disable this check. Here are some common install locations with the switch added.

#OSX
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors

#Ubuntu
/opt/google/chrome/google-chrome --ignore-certificate-errors

#Windows 7 and newer
C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe --ignore-certificate-errors

Running har-server

har-server [OPTIONS] <file.har>

Options

--hostFileIp

The IP address to associate with DNS name in the host file. Default 127.0.0.1

--listeningPort, -p

The port which har-server will listen on. If below 1024 har-server must be run as root. Default 8080

--setHostFileEntries, -h

Add host entries to host file. Host file location on Linux and OSX is assumed to be /etc/hosts, on Windows C:/Windows/System32/drivers/etc/hosts. If this setHostFileEntries is used and host file is not writable, then har-server will not run. Default false

--removeHostFileEntries, -r

When har-server receives SIGINT (ctrl+c) remove host file entries in HAR file. Must be used with setHostFileEntries. Host file location on Linux and OSX is assumed to be /etc/hosts, on Windows C:/Windows/System32/drivers/etc/hosts. If this setHostFileEntries is used and host file is not writable, then har-server will not run. Default false

--useSSL, -s

Enable HTTPS server. Default false

--listeningSslPort

The port to listen for HTTPS requests on. Default 4433

--generateKey, -g

Generate one time use SSL cert and key. This switch is ignored if sslKeyFile or sslCertFile are set. Default true

--sslKeyFile, -k

Name of file containing SSL key to use. Must also have sslCertFile set. No default

--sslCertFile, -c

Name of file containing SSL cert to use. Must also have sslKeyFile set. No default

Future plans

  • Option to compare header values before when finding response in HAR file.
  • Option to have conditional query string values when finding response in HAR file.
  • Reverse proxy requests which are not in the HAR. har-server would have to pre-fetch DNS records before modifying the host file. When a request comes in, request from the IP address and set the host header.
  • HTTP2 support.
  • Add option to use http proxy instead of editing host file, to redirect requests to har-server. This would also deal with IP based requests.
  • Option to not match on port
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].