http-master, 具有反向代理的通用前端http服务.zip

  • u7_988765
    了解作者
  • 150.1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-09 07:40
    上传日期
http-master, 具有反向代理的通用前端http服务 关于安装和基本用法。用作 MODULE的用法监视配置更改使用自定义配置加载程序功能代理程序URL重写重定向失败自动免费 ssl/letsencryptSSL协议SPDY - htt
http-master.zip
  • http-master-master
  • modules
  • services
  • letsencrypt.js
    2.5KB
  • comm.js
    2.2KB
  • logFile.js
    1.7KB
  • websockify.js
    1.3KB
  • middleware
  • auth.js
    637B
  • gzip.js
    342B
  • proxy.js
    3.1KB
  • addHeaderToResponse.js
    453B
  • websockify.js
    986B
  • log.js
    376B
  • static.js
    563B
  • addHeader.js
    452B
  • reject.js
    2KB
  • router.js
    3KB
  • redirect.js
    599B
  • letsencrypt.js
    3.7KB
  • appLog.js
    1KB
  • src
  • DispatchTable.js
    6.3KB
  • certScanner.js
    9.6KB
  • HttpMasterWorker.js
    14.7KB
  • HttpMaster.js
    9.6KB
  • keyContextLoader.js
    1.6KB
  • testUtils.js
    1.1KB
  • requestHandler.js
    648B
  • di.js
    4.2KB
  • worker.js
    3.8KB
  • regexpHelper.js
    445B
  • examples
  • exampleConfigLoader.js
    161B
  • assets
  • http-master.png
    4.3KB
  • http-master.svg
    35.2KB
  • tests
  • certs
  • startssl.pem
    9.2KB
  • unizeto-wildcard.softwaremill.com.pem
    2.1KB
  • startssl-wildcard.pacmanvps.com.pem
    11.4KB
  • unizeto-jira-e-instruments.com.pem
    2.1KB
  • unizeto.pem
    48.3KB
  • passwd
  • bcrypt.htpasswd
    70B
  • md5.htpasswd
    47B
  • sha.htpasswd
    43B
  • crypt.htpasswd
    23B
  • static_data
  • test.txt
    7B
  • 404.html
    9B
  • test2.txt.gz
    27B
  • .jshintrc
    263B
  • certScannerTest.js
    9.2KB
  • auth.js
    2.9KB
  • HttpMasterWorker.js
    8.1KB
  • HttpMaster.js
    1.5KB
  • proxy.js
    11.7KB
  • static.js
    1.4KB
  • addHeader.js
    1KB
  • di.js
    5.4KB
  • reject.js
    3.5KB
  • redirect.js
    1.7KB
  • bin
  • cert-scan
    537B
  • http-master
    6.3KB
  • sample.json
    947B
  • .jshintrc
    152B
  • yarn.lock
    66.7KB
  • migrateV1Config.js
    2.1KB
  • .travis.yml
    605B
  • http-master-upstart.conf
    240B
  • http-master.service
    227B
  • LICENSE
    1.1KB
  • README.md
    21.5KB
  • .gitignore
    92B
  • app.log
    293.5KB
  • package.json
    1.9KB
内容介绍
![http-master](https://raw.github.com/CodeCharmLtd/http-master/master/assets/http-master.png) =============== [![Package version](https://img.shields.io/npm/v/http-master.svg)](https://www.npmjs.org/package/http-master) [![Package version](https://img.shields.io/npm/dm/http-master.svg)](https://www.npmjs.org/package/http-master) [![GPA](https://img.shields.io/codeclimate/github/encharm/http-master.svg)](https://codeclimate.com/github/encharm/http-master) [![Code coverage](https://img.shields.io/codeclimate/coverage/github/encharm/http-master.svg)](https://codeclimate.com/github/encharm/http-master) [![Build status](https://img.shields.io/travis/encharm/http-master.svg)](https://travis-ci.org/encharm/http-master) [![Dependcies status](http://img.shields.io/gemnasium/encharm/http-master.svg)](https://gemnasium.com/encharm/http-master) * [About](#about) * [Installation and basic usage](#installation-and-basic-usage) * [Usage as a module](#usage-as-a-module) * [Watch config for changes](#watch-config-for-changes) * [Use custom config loader](#use-custom-config-loader) * Features * [Proxy](#proxy) * [URL rewrite](#url-rewrite) * [Redirect](#redirect) * [Automatic free SSL / Letsencrypt](#automatic-free-ssl-with-letsencrypt) * [SSL](#ssl) * [SPDY - HTTP/2 support _(experimental)_](#spdy-or-http2-support) * [Websockify](#websockify) * [Logging](#logging) * [HTTP authentication](#http-authentication) * [Add header](#add-header) * [Compression / GZIP](#gzip-compression) * [Regexp matching](#regexp-matching) * [Error handling](#error-handling) * [Serve static directory](#serve-static-directory) * [Advanced routing](#advanced-routing) * [Upstart](#upstart) * [Systemd](#systemd) * [Contributors](#contributors) * [Sponsors](#sponsors) * [License](#license) ## About http-master is a front end http service with with easy setup of reverse proxy/redirecting/other-actions logic. It means it was designed to run on your port 80 and 443 but can run on any. It can run as a module or as a standalone application. Your average use case could be having several web applications (node.js, rails, Java etc.) running on different internal ports and Apache running on port 8080. http-master allows you to easily define rules which domain should target which server and if no rules match, everything else could go to the Apache server. This way you setup your SSL in one place, in http-master and even non-SSL compatible http server can be provided with HTTPS. Many different flexible routing configurations are possible to set up. Some of the features: * Zero-effort HTTPS configuration. Provide only primary domain and configuration is loaded automatically from a given certificate directory. * Support SNI extension - multiple SSL certificates on the same IP. * Supports web sockets. * Easy all in one place configuration for every listening port (eg. 80 and 443 together) * Setup reverse proxy with optional URL rewriting and optional regexp matching of host and path. * Setup redirect with optional regexp matching to construct final URL. * Setup basic static files server for a given route. * Setup Basic-AUTH for a given route (sponsored feature) * Create logs in apache format for any given point in routing setup. * Easily turn any local or remote TCP servers to web sockets. (websockify) Destination may be determined dynamically from a path. * Allows flexible definition of matching behaviour. * Enable compression on one, any or all of the routes. * Add headers to any defined route. * Supports unicode domains out of the box. * Multi-core/cpu friendly. Runs multiple instances/workers which will serve connections in a round-robin fashion. You can of course choose to run in a single process without any workers, if you use http-master as a module or set worker count to 0. * SSL tweaked to reasonable security level supporting TLS session resumption. * Automatically watches for config changes and reloads the logic without any downtime. Simply start the deamon and add new rules while having the http-master online. * Possibility to load config from Redis/etcd or another remote resource. (\*\*) * May drop privileges to user/group once started. * Forward secrecy support when running on Node >= 0.11.14 Ongoing development on: * Easier and easier configuration format. * Automatic management of time expiration of certificates. * Request/response filters. (including to modify data) (\*\*) Needs writing a custom config loader as a javascript file. ## Installation and basic usage Refer to section [Usage as a module](#usage-as-a-module) if you are interested in that use-case. To install, Node.JS is required to be installed and in your PATH: `npm install -g http-master` (may be needed to run as root depending on your setup) To run: `http-master --config http-master.conf` Config files may be written in either JSON or YAML. For the sake of documentation (YAML allows comments) all examples will be written in YAML (but with JSON style). Simple example config (more advanced features are convered elsewhere): ```YAML watchConfig: true # watch config file for changes ports: { # each port gets a separate configuration 80: { router: { # redirect .net requests to .com 'code2flow.net': 'redirect -> http://code2flow.com/[path]', # redirect http to https 'secure.code2flow.com': 'redirect -> https://code2flow.com/[path]' # Proxy all traffic at domain code2flow.com to port 8099 'code2flow.com' : 8099, # Proxy all traffic for any subdomains of services.com to IP 192.168.10.6 and port 8099 '*.services.com' : '192.168.10.6:8099', # Proxy remaning traffic to port 8080, for example Apache could run there '*' : 8080 } } 443: { router: { 'code2flow.com': '127.0.0.1:9991', # choose application depending on path 'service.myapp.com/downloads/*': 10443, # choose application depending on path 'service.myapp.com/uploads/*': 15000, # all remaining https traffic goes to port 4443, for example apache "*": "127.0.0.1:4443" }, ssl: { # needs to be provided for non-SNI browsers primaryDomain: "code2flow.com", # simply put certificates inside this dir, run with --debug=config to see what was read certDir: "/etc/http-master/certificates" } }, middleware: ['log -> /path/to/access.log' ], # Totally optional access.log, other middleware such as gzip could be added here modules: { appLog: '/path/to/app.log' }, silent: false # if using above appLog, you can silence standard output } ``` If for some reason automatic ssl setup is not working for you, you can debug the loaded certificates with the included `cert-scan` tool: ``` cert-scan /path/to/certificate-dir ``` and/or ``` http-master --config http-master.conf --show-rules ``` Alternatively you may setup ssl manually: ```YAML # this part belongs to some port configuration ssl : { key: "/path/to/crt/domain.key", cert: "/path/to/crt/domain.crt", # or .pem "ca": [ # may be one or many or a bundle (without array) "/path/to/ca/file/sub.class1.server.ca.pem" ], "SNI": { "*.codecharm.co.uk": { "key": "/path/to/crt/codecharm.co.uk.key", "crt": "/path/to/crt/codecharm.co.uk.crt", "ca" : "/path/to/cabundle/ca.pem" # may be an array if not bundle }, "someotherdomain.com": { "key": "/path/to/crt/someotherdomain.com.key", "crt": "/path/to/crt/someotherdomain.com.crt", "ca": [ "/path/to/ca/file/someca.pem" ] } } } ``` ## Usage as a module ``` npm install --save http-master ``` ```JavaScript var HttpMaster = require('http-master'); var httpMaster = new HttpMaster(); httpMaster.init({ // your config in here }, function(err) { // listening }); ``` #### Class: HttpMaster #### Event: 'allWorkersStarted' `function()` Emitted after succesful `.init()` #### Event: 'allWorkersReloaded' `function()` Emi
评论
    相关推荐