char/plc-mirror

git clone https://git.t4t.associates/char/plc-mirror

Charlotte Somserve directly from plox; add prod configs3a509ac

main
829 B27 linesraw
1#!/usr/bin/env -S deno run
2
3import ngx from "jsr:@char/ngx@0.2";
4
5const DOMAIN = "plc.cerulea.blue";
6
7export const config = ngx("server", [
8  ngx.serverName(DOMAIN),
9  ngx.listen(),
10  ngx.letsEncrypt(DOMAIN),
11  "add_header Access-Control-Allow-Origin '*' always",
12  "add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always",
13  "add_header Access-Control-Allow-Headers '*' always",
14  ngx("location /", [
15    ngx("if ($request_method = OPTIONS)", ["return 204"]),
16    "proxy_pass http://127.0.0.1:2486",
17    "proxy_http_version 1.1",
18    "proxy_set_header Host $host",
19    "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for",
20    "proxy_set_header X-Forwarded-Proto $scheme",
21    "proxy_set_header Connection ''",
22  ]),
23]);
24
25export const path = "plc.conf";
26
27if (import.meta.main) console.log(config.build());