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 URIfile://astrowhich 👉points to./public/astroqwik.to local filesystem URIfile://qwikwhich 👉points to./public/qwikyaytapi.to a local server at the URIhttp://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"
}
}- Path to cert (required)
- Path to privkey (required)
- Path to proxy map (defaults to serving
public/) - Number of workers (defaults to 1)
./simple_rust_server path_to_cert.pem path_to_privkey.pem path_to_proxy_map.json 1I 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:
- https://marmadilemanteater.dev
- https://qwik.marmadilemanteater.dev
- https://astro.marmadilemanteater.dev
You can also see the GH action which deployed that server instance to linode here: