Giter Site home page Giter Site logo

marcokrooss / cprox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from noblemajo/cprox

0.0 0.0 0.0 340 KB

CProX is an easy to configure static serve, redirect, reverse proxy and load balancing web server.

License: MIT License

Shell 0.93% JavaScript 0.02% TypeScript 98.72% HTML 0.01% Dockerfile 0.32%

cprox's Introduction

CProX

Docker CI/CD CI/CD MIT

typescript npm github

table of contents

about

| Docker Hub | GitHub |
CProX is an easy to configure static serve, redirect, reverse proxy and load balancing web server.

details

  • Support for http, https, ws, wss and any subprotocol.
  • Its a free open source project.
  • Available on github.com, npmjs.com and hub.docker.com.
  • Simple cli tool and easy envtionment variables.
  • Automatically self-signed certificate if required and not disabled!

configuration

example

cprox \
    *=STATIC:/var/www/html \
    */test=STATIC:/var/www/test \
    example.com=REDIRECT:https://www.example.com \
    www.example.com=STATIC:/var/www/example \
    www.example.com/proxy=PROXY:http://127.0.0.1:58080

guide

Please checkout the configuration guide.

gettings started

Checkout the test.sh and the start.sh scripts to understand what you need to think about and how to start the server.

NodeJS

tested with

  • node v16
  • npm v8

install

npm i -g cprox

run

Run as redirect server:

cprox *=REDIRECT:https://start.duckduckgo.com

Run as static file server:

cprox *=STATIC:/var/www/html

Run as proxy server:

cprox *=PROXY:http://127.0.0.1:8080

Cli tool help output:

cprox -h

Docker

tested with

  • Ubuntu v20.04
  • Docker v20.10.16

pull

docker pull majo418/cprox:latest

run

docker run -it --rm \
  -p 80:80 \
  -p 443:443 \
  -v $(pwd)/certs:/app/certs \
  majo418/cprox \
    *=REDIRECT:https://start.duckduckgo.com

help

docker run -it --rm majo418/cprox -h

help output

# CPROX #

Usage: cprox [OPTIONS] COMMAND [ARGUMENTS]

CProX is a easy to configure redirect, proxy and static webserver

Options:
  -v, --verbose                                  Show basic flag adn target informations (default: 'false', ENV: 'VERBOSE')
      --dry-run                                  Exit cprox before final start server step. (default: 'false', ENV: 'DRYRUN')
  -p, --http-port [number]                       Set the http port (default: 80 but disabled if any port is set) (default: '80', ENV: 'HTTP_PORT')
  -s, --https-port [number]                      Set the https port (default: 443 but disabled if any port is set) (default: '443', ENV: 'HTTPS_PORT')
  -t, --trust-all-certs                          Trust all certificates on proxy (default: 'false', ENV: 'TRUST_ALL_CERTS')
  -b, --bind-host-address [string]               Set the host where the server pind the ports (default: '0.0.0.0', ENV: 'BIND_ADDRESS')
      --disable-self-singed                      Disable generating self singed certificates if not exist (default: 'false', ENV: 'DISABLE_SELF_SINGED')
      --self-singed-country-code [string]        Set the country code for the self singed certificate (default: 'INT', ENV: 'SELF_SINGED_COUNTRY_CODE')
      --self-singed-common-domain-name [string]  Set the common domain name for the self singed certificate (default: 'example.com', ENV: 'SELF_SINGED_COMMON_DOMAIN_NAME')
      --self-singed-state-name [string]          Set the state name for the self singed certificate (default: 'International', ENV: 'SELF_SINGED_STATE_NAME')
      --self-singed-locality-name [string]       Set the locality name for the self singed certificate (default: 'International', ENV: 'SELF_SINGED_LOCALITY_NAME')
      --self-singed-organization-name [string]   Set the organization name for the self singed certificate (default: 'None', ENV: 'SELF_SINGED_ORGANIZATION_NAME')
      --self-singed-email-address [string]       Set the email address for the self singed certificate (default: '[email protected]', ENV: 'SELF_SINGED_EMAIL_ADDRESS')
      --self-singed-netscape-comment [string]    Set the netscape comment for the self singed certificate (default: 'Self-Singed SSL Certificate by the CProX Server Software', ENV: 'SELF_SINGED_NETSCAPE_COMMENT')
      --dns-server-address [string]              Add a dns address to the existing dns addresses (default: '127.0.0.11,1.0.0.1,8.8.4.4,1.1.1.1,8.8.8.8', ENV: 'DNS_SERVER_ADDRESSES')
      --cert-path [string]                       Define the path for the certificates (default: './certs', ENV: 'CERT_PATH')
      --cert-name [string]                       Define the name for the certificates cert file (default: 'cert.pem', ENV: 'CERT_NAME')
      --key-name [string]                        Define the name for the certificates key file (default: 'privkey.pem', ENV: 'KEY_NAME')
      --ca-name [string]                         Define the name for the certificate ca file (default: 'chain.pem', ENV: 'CA_NAME')
  -r, --rule [string]                            CProX rules
      --max-header-size [number | string]        Define the maximum request header size (default: 1024 * 4) (default: '4096', ENV: 'MAX_HEADER_SIZE')
      --connection-timeout [number | string]     Define the maximum time in miliseconds (or as millisecond calucaltion) for a open conneciton (default: '15000', ENV: 'CONNECTION_TIMEOUT')
      --proxy-reaction-timeout [number | string] Define the maximum time in miliseconds (or as millisecond calucaltion) that the proxy target has to respond (default: '3000', ENV: 'PROXY_REACTION_TIMEOUT')
      --proxy-verify-certificate                 Proxy verify target certificates (default: 'false', ENV: 'PROXY_VERIFY_CERTIFICATE')
      --proxy-follow-redirects                   Proxy follow redirects (default: 'false', ENV: 'PROXY_FOLLOW_REDIRECTS')
  -h, --help                                     Shows this help output

Commands:
version Shows the version of cprox

Details:
You can use CProX as webserver. It can proxy, redirect and service static content on requests

! CProX | by majo418 | supported by CoreUnit.NET !

usage recommendation

Running the program under different conditions might work, have unpredictable effects, or might work only partially or not at all.
The program was tested under the following conditions:

  • node.js v20+
  • npm v9+
  • ubuntu 22.04+

references

contribution

feature request

Create a issue with "Feature: " at the begin if the title.

issues

Create a issue with "Issues: " at the begin if the title.

develop

    1. fork the project
    1. implement your idea
    1. create a pull/merge request
// please create seperated forks for different kind of featues/ideas/structure changes/implementations

cya ;3
by NobleMajo

cprox's People

Contributors

noblemajo avatar marcokrooss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.