Git Product home page Git Product logo

simplereverseproxy's Introduction

A simple actix-web reverse proxy

This is a simple 🕸actix-web server which 🗺maps subdomains to URIs. It accepts three arguments: path_to_cert, path_to_privkey, and path_to_map.json.

Here is an example JSON map which:

  • Maps requests with no sub-domain to a local server at the URI http://127.0.0.1:3000
  • Maps requests with sub-domains:
    • astro. to local filesystem URI file://astro which 👉points to ./public/astro
    • qwik. to local filesystem URI file://qwik which 👉points to ./public/qwik
    • yaytapi. to a local server at the URI http://127.0.0.1:8080

(Note: All filesystem URIs are use the ./public folder as the root: file:// -> ./public/)

{
  ".": {
    "protocol": "http",
    "uri": "127.0.0.1",
    "port": "3000"
  },
  "astro": {
    "protocol": "file",
    "uri": "astro"
  },
  "qwik": {
    "protocol": "file",
    "uri": "qwik"
  },
  "yaytapi": {
    "protocol": "http",
    "uri": "127.0.0.1",
    "port": "8080"
  }
}

⚒ Usage

Arguments

  1. Path to cert (required)
  2. Path to privkey (required)
  3. Path to proxy map (defaults to serving public/)
  4. Number of workers (defaults to 1)
./simple_rust_server path_to_cert.pem path_to_privkey.pem path_to_proxy_map.json 1

❗ Purpose

I started by trying to host a sveltekit server, and the solution I found for securing my server was just to use a reverse proxy, so I wrote this using a tutorial and an example for actix-web. This is also partially inspired by estk/Soxy.

You can see an instance of this server running by visiting any of these subdomains:

You can also see the GH action which deployed that server instance to linode here:

badge

simplereverseproxy's People

Contributors

marmadilemanteater avatar

Stargazers

Anne Thorpe avatar  avatar Aitor avatar Đamien ℺azar avatar

Watchers

 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.