1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00

Create cool site for Reproxy (#30)

by @akellbl4 

* make cool site for reproxy

* remove meta tags with images

* fix dark theme

* flix styles for sidebar nav

* add scroll in sidebar

* fix dark theme

* fix markdown

* remove package lock

* add package lock to ignore

* add update date and edit button

* add build command

* move target to public

* add build

* use gitignore

* add logos

* Changes

- add meta
- add close button

* add style for code tag

* fix favicon color in safari

* add logo styles

* update favicon

* add classic ico favicon

* update touch icon

* fix sharing images

* fix logo

* move data to site data file

* add fancy mate glass effect on header

* make readme as site base

* update logo

update logo

* add stretching width for the content

* add dockerfile

* fix dark theme bugs

* remove usless props

* fix logo

* fix node version

* replce logo for the site

* fix path to logo in readme

* add more space on logo in readme

* fix logo size in readme
This commit is contained in:
Pavel Mineev 2021-04-16 20:34:03 +03:00 committed by GitHub
parent 8dca98c6b3
commit ab9c5864bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 4925 additions and 107 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@
access.log
var/
dist/
docker-compose-private.yml
docker-compose-private.yml
.vscode

View File

@ -20,6 +20,9 @@ race_test:
build: info
- cd app && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.revision=$(REV) -s -w" -o ../dist/reproxy
build_site:
- cd site && yarn build
info:
- @echo "revision $(REV)"

View File

@ -1,16 +1,15 @@
# reproxy [![build](https://github.com/umputun/reproxy/actions/workflows/ci.yml/badge.svg)](https://github.com/umputun/reproxy/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/umputun/reproxy/badge.svg?branch=master)](https://coveralls.io/github/umputun/reproxy?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/umputun/reproxy)](https://goreportcard.com/report/github.com/umputun/reproxy) [![Docker Automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/repository/docker/umputun/reproxy)
Reproxy is a simple edge HTTP(s) server / reverse proxy supporting various providers (docker, static, file).
One or more providers supply information about requested server, requested url, destination url and health check url.
Distributed as a single binary or as a docker container.
Server can be set as FQDN, i.e. `s.example.com` or `*` (catch all). Requested url can be regex, for example `^/api/(.*)` and destination url may have regex matched groups in, i.e. `http://d.example.com:8080/$1`. For the example above `http://s.example.com/api/something?foo=bar` will be proxied to `http://d.example.com:8080/something?foo=bar`.
For convenience, requests with the trailing `/` and without regex groups expanded to `/(.*)`, and destinations in those cases
expanded to `/$1`. I.e. `/api/` -> `http://127.0.0.1/service` will be translated to `^/api/(.*)` -> `http://127.0.0.1/service/$1`
For convenience, requests with the trailing `/` and without regex groups expanded to `/(.*)`, and destinations in those cases
expanded to `/$1`. I.e. `/api/` -> `http://127.0.0.1/service` will be translated to `^/api/(.*)` -> `http://127.0.0.1/service/$1`
Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates.
Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates.
Optional assets server can be used to serve static files.
Starting reproxy requires at least one provider defined. The rest of parameters are strictly optional and have sane default.
@ -40,7 +39,7 @@ This is the simplest provider defining all mapping rules directly in the command
Each rule is 3 or 4 comma-separated elements `server,sourceurl,destination,[ping-url]`. For example:
- `*,^/api/(.*),https://api.example.com/$1,` - proxy all request to any host/server with `/api` prefix to `https://api.example.com`
- `example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping` - proxy all requests to `example.com` and with `/foo/bar` url to `https://api.example.com/zzz`. Uses `https://api.example.com/ping` for the health check
- `example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping` - proxy all requests to `example.com` and with `/foo/bar` url to `https://api.example.com/zzz`. Uses `https://api.example.com/ping` for the health check
The last (4th) element defines an optional ping url used for health reporting. I.e.`*,^/api/(.*),https://api.example.com/$1,https://api.example.com/ping`. See [Health check](https://github.com/umputun/reproxy#ping-and-health-checks) section for more details.
@ -52,24 +51,27 @@ example of `config.yml`:
```yaml
default: # the same as * (catch-all) server
- {route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/blah1/$1"}
- {route: "/api/svc3/xyz", dest: "http://127.0.0.3:8080/blah3/xyz", "ping": "http://127.0.0.3:8080/ping"}
- { route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/blah1/$1" }
- {
route: "/api/svc3/xyz",
dest: "http://127.0.0.3:8080/blah3/xyz",
"ping": "http://127.0.0.3:8080/ping",
}
srv.example.com:
- {route: "^/api/svc2/(.*)", dest: "http://127.0.0.2:8080/blah2/$1/abc"}
- { route: "^/api/svc2/(.*)", dest: "http://127.0.0.2:8080/blah2/$1/abc" }
```
This is a dynamic provider and file change will be applied automatically.
### Docker
Docker provider supports a fully automatic discovery (with `--docker.auto`) with no extra configuration and by default redirects all requests like `https://server/<container_name>/(.*)` to the internal IP of the given container and the exposed port. Only active (running) containers will be detected.
Docker provider supports a fully automatic discovery (with `--docker.auto`) with no extra configuration and by default redirects all requests like `https://server/<container_name>/(.*)` to the internal IP of the given container and the exposed port. Only active (running) containers will be detected.
This default can be changed with labels:
- `reproxy.server` - server (hostname) to match. Also can be a list of comma-separated servers.
- `reproxy.route` - source route (location)
- `reproxy.dest` - destination path. Note: this is not full url, but just the path which will be appended to container's ip:port
- `reproxy.dest` - destination path. Note: this is not full url, but just the path which will be appended to container's ip:port
- `reproxy.port` - destination port for the discovered container
- `reproxy.ping` - ping path for the destination container.
- `reproxy.enabled` - enable (`yes`, `true`, `1`) or disable (`no`, `false`, `0`) container from reproxy destinations.
@ -86,9 +88,9 @@ This is a dynamic provider and any change in container's status will be applied
## SSL support
SSL mode (by default none) can be set to `auto` (ACME/LE certificates), `static` (existing certificate) or `none`. If `auto` turned on SSL certificate will be issued automatically for all discovered server names. User can override it by setting `--ssl.fqdn` value(s)
SSL mode (by default none) can be set to `auto` (ACME/LE certificates), `static` (existing certificate) or `none`. If `auto` turned on SSL certificate will be issued automatically for all discovered server names. User can override it by setting `--ssl.fqdn` value(s)
## Logging
## Logging
By default no request log generated. This can be turned on by setting `--logger.enabled`. The log (auto-rotated) has [Apache Combined Log Format](http://httpd.apache.org/docs/2.2/logs.html#combined)
@ -106,7 +108,7 @@ User may turn assets server on (off by default) to serve static files. As long a
In addition to the common assets server multiple custom static servers supported. Each provider has a different way to define such static rule and some providers may not support it at all. For example, multiple static server make sense in case of static (command line provide), file provider and can be even useful with docker provider.
1. static provider - if source element prefixed by `assets:` it will be treated as file-server. For example `*,assets:/web,/var/www,` will serve all `/web/*` request with a file server on top of `/var/www` directory.
2. file provider - setting optional field `assets: true`
2. file provider - setting optional field `assets: true`
3. docker provider - `reproxy.assets=web-root:location`, i.e. `reproxy.assets=/web:/var/www`.
## More options
@ -121,7 +123,7 @@ In addition to the common assets server multiple custom static servers supported
reproxy provides 2 endpoints for this purpose:
- `/ping` responds with `pong` and indicates what reproxy up and running
- `/health` returns `200 OK` status if all destination servers responded to their ping request with `200` or `417 Expectation Failed` if any of servers responded with non-200 code. It also returns json body with details about passed/failed services.
- `/health` returns `200 OK` status if all destination servers responded to their ping request with `200` or `417 Expectation Failed` if any of servers responded with non-200 code. It also returns json body with details about passed/failed services.
## All Application Options

View File

@ -1,91 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>reproxy</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Reproxy is a minimalistic system acting as an edge server / reverse proxy for your infrastructure. It provides the only essential functionality with no bells and whistles. Setup is very straightforward and not much to configure.">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@300&display=swap">
<style>
/* Reset styles for cross browser compatibility */
* {
padding: 0;
margin: 0;
}
html {
display: flex;
min-height: 100%;
}
body {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-family: 'Inconsolata', monospace;
font-size: 25px;
text-align: center;
}
article {
max-width: 650px;
padding: 15px;
text-align: left;
}
article > * + * {
margin-top: 25px;
}
h1 {
font-size: 40px;
font-weight: bold;
}
ul {
padding-left: 40px;
}
a {
color: #dc8100;
}
a:hover {
color: #333;
text-decoration: none;
}
</style>
</head>
<body>
<article>
<h1>Simple Reverse Proxy</h1>
<p>Reproxy is a minimalistic system acting as an edge server / reverse proxy for your infrastructure. It provides the only essential functionality with no bells and whistles. Setup is very straightforward and not much to configure.</p>
<ul>
<li>Automatic SSL termination with Lets Encrypt</li>
<li>Support of user-provided ssl certificates</li>
<li>Simple but flexible proxy rules</li>
<li>Static, command line proxy rules provider</li>
<li>Dynamic, file-based proxy rules provider</li>
<li>Docker provider with an automatic discovery</li>
<li>Optional traffic compression</li>
<li>User-defined limits and timeouts</li>
<li>Single binary distribution</li>
<li>Docker container distribution</li>
<li>Builtin static assets server</li>
<li><a href="https://github.com/umputun/reproxy">Open source</a></li>
</ul>
<p>&mdash; reproxy team</p>
</article>
</body>
</html>

6
site/.dockerignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
.gitignore
.prettierrc
.dockerignore
Dockerfile
public

89
site/.eleventy.js Normal file
View File

@ -0,0 +1,89 @@
const fs = require('fs')
const path = require('path')
const htmlmin = require('html-minifier')
const markdownIt = require('markdown-it')
const markdownItAnchor = require('markdown-it-anchor')
const toc = require('@thedigitalman/eleventy-plugin-toc-a11y')
const fns = require('date-fns')
function getVersion() {
return `reproxy-${Date.now()}`
}
function transformHTML(content, outputPath) {
if (!outputPath?.endsWith('.html')) {
return content
}
return htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
})
}
function transformMarkdown() {
return markdownIt({
html: true,
breaks: true,
linkify: true,
}).use(markdownItAnchor, {
permalink: true,
permalinkClass: '',
permalinkSymbol: '',
})
}
function replaceLogo(content) {
const filepath = path.resolve(__dirname, './src/logo.svg')
const svg = fs.readFileSync(filepath, 'utf-8')
return content.replace(/<img class="logo"(.*?)>/gi, svg)
}
function getReadableDate(date) {
return fns.format(new Date(date), 'LLL dd, yyyy')
}
function getISODate(date) {
return fns.format(new Date(date), 'yyyy-mm-dd')
}
module.exports = (config) => {
config.addShortcode('version', getVersion)
// Pluigns
config.addPlugin(toc, {
tags: ['h2', 'h3'],
heading: false,
listType: 'ul',
wrapperClass: 'docs-nav',
listClass: 'pl-5',
listItemClass: 'mb-2',
listItemAnchorClass:
'inline-block p-1 hover:text-gray-900 dark:hover:text-gray-200',
})
// HTML transformations
config.addTransform('replaceLogo', replaceLogo)
config.addTransform('htmlmin', transformHTML)
// Date formaters
config.addFilter('humanizeDate', getReadableDate)
config.addFilter('isoDate', getISODate)
// Markdown
config.setLibrary('md', transformMarkdown())
// Other files
config.addPassthroughCopy({ 'src/public/*': '.' })
return {
dir: {
input: 'src',
output: 'public',
data: 'data',
layouts: 'layouts',
includes: 'includes',
},
}
}

4
site/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
_tmp
node_modules
yarn-*
package-lock.json

5
site/.prettierrc Normal file
View File

@ -0,0 +1,5 @@
{
"semi": false,
"useTabs": true,
"singleQuote": true
}

11
site/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:14-alpine
WORKDIR build
COPY . /build
RUN yarn --frozen-lockfile && \
yarn build && \
ls -la /public
CMD ["sleep", "100"]

39
site/package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "reproxy",
"version": "0.0.0",
"repository": "https://github.com/umputun/reproxy/site",
"author": "Pavel Mineev <pavel@mineev.me>",
"license": "MIT",
"private": true,
"engines": {
"node": ">= 14.15"
},
"scripts": {
"build": "cross-env NODE_ENV=production run-s build:* --print-label",
"build:clean": "rm -rf public/*",
"build:css": "postcss src/main.css -o src/includes/main.css",
"build:eleventy": "eleventy",
"dev": "run-p dev:*",
"dev:css": "postcss src/main.css -o public/main.css -w",
"dev:eleventy": "eleventy --serve --watch"
},
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-navigation": "^0.2.0",
"@tailwindcss/typography": "^0.4.0",
"@thedigitalman/eleventy-plugin-toc-a11y": "^2.0.2",
"autoprefixer": "^10.2.5",
"cross-env": "^7.0.3",
"cssnano": "^5.0.1",
"date-fns": "^2.21.0",
"html-minifier": "^4.0.0",
"markdown-it": "^12.0.4",
"markdown-it-anchor": "^7.1.0",
"markdown-it-link-attributes": "^3.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.10",
"postcss-cli": "^8.3.1",
"prettier": "^2.2.1",
"tailwindcss": "^2.1.1"
}
}

7
site/postcss.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
cssnano: {},
},
}

BIN
site/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
site/public/favicon.svg Normal file
View File

@ -0,0 +1 @@
<svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 8l7-3v11L2 8z" fill="#FF7A00"/><path d="M15 8l-6 3V0l6 8z" fill="#FFB35A"/></svg>

After

Width:  |  Height:  |  Size: 169 B

105
site/public/index.html Normal file

File diff suppressed because one or more lines are too long

13
site/public/manifest.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "Reproxy",
"short_name": "Reproxy",
"icons": [
{
"src": "touch-icon.png",
"sizes": "512x512"
}
],
"background_color": "#ffffff",
"theme_color": "#FF7A00",
"display": "fullscreen"
}

BIN
site/public/sharing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
site/public/touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

1
site/src/data/layout.js Normal file
View File

@ -0,0 +1 @@
module.exports = 'default.njk'

11
site/src/data/site.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
env: process.env.NODE_ENV,
date: Date.now(),
githubUrl: 'https://github.com/umputun/reproxy/site',
githubBranch: 'master',
url: 'https://reproxy.io',
title: 'Reproxy',
subtitle: 'Simple Reverse Proxy',
description:
'Reproxy is a minimalistic system acting as an edge server / reverse proxy for your infrastructure. It provides the only essential functionality with no bells and whistles. Setup is very straightforward and not much to configure.',
}

1
site/src/includes/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.css

38
site/src/includes/main.js Normal file
View File

@ -0,0 +1,38 @@
const sidebarElement = document.getElementById('sidebar')
const sidebarOpenButton = document.getElementById('sidebar-open-button')
const sidebarCloseButton = document.getElementById('sidebar-close-button')
const sidebarLinks = sidebarElement.querySelectorAll('a')
sidebarOpenButton.addEventListener('click', toggleSidebar)
sidebarCloseButton.addEventListener('click', closeSidebar)
Array.from(sidebarLinks).forEach((l) => {
l.addEventListener('click', () => {
if (!isShow()) {
return
}
closeSidebar()
})
})
function openSidebar() {
document.body.classList.add('overflow-hidden')
sidebarElement.classList.remove('hidden')
}
function closeSidebar() {
sidebarElement.classList.add('hidden')
document.body.classList.remove('overflow-hidden')
}
function isShow() {
return !sidebarElement.classList.contains('hidden')
}
function toggleSidebar() {
if (isShow()) {
closeSidebar()
} else {
openSidebar()
}
}

210
site/src/index.md Normal file
View File

@ -0,0 +1,210 @@
<div align="center">
<img class="logo" src="https://raw.githubusercontent.com/akellbl4/reproxy/site/site/src/logo-bg.svg" width="355px" height="142px" alt="Reproxy | Simple Reverse Proxy"/>
</div>
Reproxy is a simple edge HTTP(s) server / reverse proxy supporting various providers (docker, static, file).
One or more providers supply information about requested server, requested url, destination url and health check url.
Distributed as a single binary or as a docker container.
- Automatic SSL termination with <a href="https://letsencrypt.org/" rel="nofollow noopener noreferrer" target="_blank">Let's Encrypt</a>
- Support of user-provided SSL certificates
- Simple but flexible proxy rules
- Static, command line proxy rules provider
- Dynamic, file-based proxy rules provider
- Docker provider with an automatic discovery
- Optional traffic compression
- User-defined limits and timeouts
- Single binary distribution
- Docker container distribution
- Built-in static assets server
[![build](https://github.com/umputun/reproxy/actions/workflows/ci.yml/badge.svg)](https://github.com/umputun/reproxy/actions/workflows/ci.yml)&nbsp;[![Coverage Status](https://coveralls.io/repos/github/umputun/reproxy/badge.svg?branch=master)](https://coveralls.io/github/umputun/reproxy?branch=master)&nbsp;[![Go Report Card](https://goreportcard.com/badge/github.com/umputun/reproxy)](https://goreportcard.com/report/github.com/umputun/reproxy)&nbsp;[![Docker Automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/repository/docker/umputun/reproxy)
Server can be set as FQDN, i.e. `s.example.com` or `*` (catch all). Requested url can be regex, for example `^/api/(.*)` and destination url may have regex matched groups in, i.e. `http://d.example.com:8080/$1`. For the example above `http://s.example.com/api/something?foo=bar` will be proxied to `http://d.example.com:8080/something?foo=bar`.
For convenience, requests with the trailing `/` and without regex groups expanded to `/(.*)`, and destinations in those cases
expanded to `/$1`. I.e. `/api/` -> `http://127.0.0.1/service` will be translated to `^/api/(.*)` -> `http://127.0.0.1/service/$1`
Both HTTP and HTTPS supported. For HTTPS, static certificate can be used as well as automated ACME (Let's Encrypt) certificates.
Optional assets server can be used to serve static files.
Starting reproxy requires at least one provider defined. The rest of parameters are strictly optional and have sane default.
example with a static provider:
`reproxy --static.enabled --static.rule="example.com/api/(.*),https://api.example.com/$1"`
example with an automatic docker discovery:
`reproxy --docker.enabled --docker.auto`
## Install
- for a binary distribution pick the proper file in the [release section](https://github.com/umputun/reproxy/releases)
- docker container available on [Docker Hub](https://hub.docker.com/r/umputun/reproxy) as well as on [Github Container Registry](ghcr.io/umputun/reproxy).
Latest stable version has `:vX.Y.Z` tag (with `:latest` alias) and the current master has `:master` tag.
## Providers
User can sets multiple providers at the same time.
_See examples of various providers in [examples](https://github.com/umputun/reproxy/tree/master/examples)_
### Static
This is the simplest provider defining all mapping rules directly in the command line (or environment). Multiple rules supported.
Each rule is 3 or 4 comma-separated elements `server,sourceurl,destination,[ping-url]`. For example:
- `*,^/api/(.*),https://api.example.com/$1,` - proxy all request to any host/server with `/api` prefix to `https://api.example.com`
- `example.com,/foo/bar,https://api.example.com/zzz,https://api.example.com/ping` - proxy all requests to `example.com` and with `/foo/bar` url to `https://api.example.com/zzz`. Uses `https://api.example.com/ping` for the health check
The last (4th) element defines an optional ping url used for health reporting. I.e.`*,^/api/(.*),https://api.example.com/$1,https://api.example.com/ping`. See [Health check](https://github.com/umputun/reproxy#ping-and-health-checks) section for more details.
### File
`reproxy --file.enabled --file.name=config.yml`
Example of `config.yml`:
```yaml
default: # the same as * (catch-all) server
- { route: '^/api/svc1/(.*)', dest: 'http://127.0.0.1:8080/blah1/$1' }
- {
route: '/api/svc3/xyz',
dest: 'http://127.0.0.3:8080/blah3/xyz',
'ping': 'http://127.0.0.3:8080/ping',
}
srv.example.com:
- { route: '^/api/svc2/(.*)', dest: 'http://127.0.0.2:8080/blah2/$1/abc' }
```
This is a dynamic provider and file change will be applied automatically.
### Docker
Docker provider supports a fully automatic discovery (with `--docker.auto`) with no extra configuration and by default redirects all requests like `https://server/<container_name>/(.*)` to the internal IP of the given container and the exposed port. Only active (running) containers will be detected.
This default can be changed with labels:
- `reproxy.server` - server (hostname) to match. Also can be a list of comma-separated servers.
- `reproxy.route` - source route (location)
- `reproxy.dest` - destination path. Note: this is not full url, but just the path which will be appended to container's ip:port
- `reproxy.port` - destination port for the discovered container
- `reproxy.ping` - ping path for the destination container.
- `reproxy.enabled` - enable (`yes`, `true`, `1`) or disable (`no`, `false`, `0`) container from reproxy destinations.
Pls note: without `--docker.auto` the destination container has to have at least one of `reproxy.*` labels to be considered as a potential destination.
With `--docker.auto`, all containers with exposed port will be considered as routing destinations. There are 3 ways to restrict it:
- Exclude some containers explicitly with `--docker.exclude`, i.e. `--docker.exclude=c1 --docker.exclude=c2 ...`
- Allow only a particular docker network with `--docker.network`
- Set the label `reproxy.enabled=false` or `reproxy.enabled=no` or `reproxy.enabled=0`
This is a dynamic provider and any change in container's status will be applied automatically.
## SSL support
SSL mode (by default none) can be set to `auto` (ACME/LE certificates), `static` (existing certificate) or `none`. If `auto` turned on SSL certificate will be issued automatically for all discovered server names. User can override it by setting `--ssl.fqdn` value(s)
## Logging
By default no request log generated. This can be turned on by setting `--logger.enabled`. The log (auto-rotated) has [Apache Combined Log Format](http://httpd.apache.org/docs/2.2/logs.html#combined)
User can also turn stdout log on with `--logger.stdout`. It won't affect the file logging but will output some minimal info about processed requests, something like this:
```
2021/04/16 01:17:25.601 [INFO] GET - /echo/image.png - xxx.xxx.xxx.xxx - 200 (155400) - 371.661251ms
2021/04/16 01:18:18.959 [INFO] GET - /api/v1/params - xxx.xxx.xxx.xxx - 200 (74) - 1.217669m
```
## Assets Server
User may turn assets server on (off by default) to serve static files. As long as `--assets.location` set it will treat every non-proxied request under `assets.root` as a request for static files. Assets server can be used without any proxy providers. In this mode reproxy acts as a simple web server for a static context.
In addition to the common assets server multiple custom static servers supported. Each provider has a different way to define such static rule and some providers may not support it at all. For example, multiple static server make sense in case of static (command line provide), file provider and can be even useful with docker provider.
1. static provider - if source element prefixed by `assets:` it will be treated as file-server. For example `*,assets:/web,/var/www,` will serve all `/web/*` request with a file server on top of `/var/www` directory.
2. file provider - setting optional field `assets: true`
3. docker provider - `reproxy.assets=web-root:location`, i.e. `reproxy.assets=/web:/var/www`.
## More options
- `--gzip` enables gizp compression for responses.
- `--max=N` allows to set the maximum size of request (default 64k)
- `--header` sets extra header(s) added to each proxied request
- `--timeout.*` various timeouts for both server and proxy transport. See `timeout` section in [All Application Options](https://github.com/umputun/reproxy#all-application-options)
## Ping and health checks
reproxy provides 2 endpoints for this purpose:
- `/ping` responds with `pong` and indicates what reproxy up and running
- `/health` returns `200 OK` status if all destination servers responded to their ping request with `200` or `417 Expectation Failed` if any of servers responded with non-200 code. It also returns json body with details about passed/failed services.
## All Application Options
```
-l, --listen= listen on host:port (default: 127.0.0.1:8080) [$LISTEN]
-m, --max= max response size (default: 64000) [$MAX_SIZE]
-g, --gzip enable gz compression [$GZIP]
-x, --header= proxy headers [$HEADER]
--signature enable reproxy signature headers [$SIGNATURE]
--dbg debug mode [$DEBUG]
ssl:
--ssl.type=[none|static|auto] ssl (auto) support (default: none) [$SSL_TYPE]
--ssl.cert= path to cert.pem file [$SSL_CERT]
--ssl.key= path to key.pem file [$SSL_KEY]
--ssl.acme-location= dir where certificates will be stored by autocert manager (default: ./var/acme) [$SSL_ACME_LOCATION]
--ssl.acme-email= admin email for certificate notifications [$SSL_ACME_EMAIL]
--ssl.http-port= http port for redirect to https and acme challenge test (default: 80) [$SSL_HTTP_PORT]
--ssl.fqdn= FQDN(s) for ACME certificates [$SSL_ACME_FQDN]
assets:
-a, --assets.location= assets location [$ASSETS_LOCATION]
--assets.root= assets web root (default: /) [$ASSETS_ROOT]
logger:
--logger.stdout enable stdout logging [$LOGGER_STDOUT]
--logger.enabled enable access and error rotated logs [$LOGGER_ENABLED]
--logger.file= location of access log (default: access.log) [$LOGGER_FILE]
--logger.max-size= maximum size in megabytes before it gets rotated (default: 100) [$LOGGER_MAX_SIZE]
--logger.max-backups= maximum number of old log files to retain (default: 10) [$LOGGER_MAX_BACKUPS]
docker:
--docker.enabled enable docker provider [$DOCKER_ENABLED]
--docker.host= docker host (default: unix:///var/run/docker.sock) [$DOCKER_HOST]
--docker.network= docker network [$DOCKER_NETWORK]
--docker.exclude= excluded containers [$DOCKER_EXCLUDE]
--docker.auto enable automatic routing (without labels) [$DOCKER_AUTO]
file:
--file.enabled enable file provider [$FILE_ENABLED]
--file.name= file name (default: reproxy.yml) [$FILE_NAME]
--file.interval= file check interval (default: 3s) [$FILE_INTERVAL]
--file.delay= file event delay (default: 500ms) [$FILE_DELAY]
static:
--static.enabled enable static provider [$STATIC_ENABLED]
--static.rule= routing rules [$STATIC_RULES]
timeout:
--timeout.read-header= read header server timeout (default: 5s) [$TIMEOUT_READ_HEADER]
--timeout.write= write server timeout (default: 30s) [$TIMEOUT_WRITE]
--timeout.idle= idle server timeout (default: 30s) [$TIMEOUT_IDLE]
--timeout.dial= dial transport timeout (default: 30s) [$TIMEOUT_DIAL]
--timeout.keep-alive= keep-alive transport timeout (default: 30s) [$TIMEOUT_KEEP_ALIVE]
--timeout.resp-header= response header transport timeout (default: 5s) [$TIMEOUT_RESP_HEADER]
--timeout.idle-conn= idle connection transport timeout (default: 90s) [$TIMEOUT_IDLE_CONN]
--timeout.tls= TLS hanshake transport timeout (default: 10s) [$TIMEOUT_TLS]
--timeout.continue= expect continue transport timeout (default: 1s) [$TIMEOUT_CONTINUE]
Help Options:
-h, --help Show this help message
```
## Status
The project is under active development and may have breaking changes till `v1` released.

View File

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{{ site.title }}</title>
<link rel="icon" href="/favicon.svg"/>
<link rel="mask-icon" href="/favicon.svg" color="#FF7A00"/>
<link rel="apple-touch-icon" href="/touch-icon.png"/>
<meta name="theme-color" content="#FF7A00"/>
<meta property="og:title" content="{{ site.title }}"/>
<meta name="description" content="{{ site.description }}"/>
<meta property="og:description" content="{{ site.description }}"/>
<meta property="og:image" content="{{ site.url }}/sharing.png"/>
<meta property="og:image:width" content="1080"/>
<meta property="og:image:height" content="512"/>
<meta property="twitter:image" content="{{ site.url }}/sharing.png"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="{{ site.url }}"/>
<meta property="og:locale" content="en_US"/>
<meta name="twitter:card" content="summary_large_image"/>
{% if site.env === 'production' %}
{% set css %}{% include "main.css" %}{% endset %}
<style>{{ css | safe }}</style>
{% else %}
<link rel="stylesheet" href="/main.css"/>
{% endif %}
</head>
<body class="h-screen bg-white dark:bg-gray-900">
<header class="fixed top-0 left-0 z-20 w-full border-b border-gray-100 bg-opacity-75 backdrop-filter backdrop-blur-lg bg-white dark:bg-gray-900 transition-colors duration-200 dark:bg-dark dark:border-gray-800">
<nav class="flex items-center h-16 md:h-20 w-full py-2">
<div class="p-4 mr-auto">
<span class="text-xl font-bold text-orange-600 dark:text-gray-300">{{ site.title }}</span>
<span class="block mt-1 text-sm md:text-md text-gray-500 dark:text-gray-400">{{ site.subtitle }}</span>
</div>
<div class="mr-3">
<a class="text-gray-400 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-200" aria-label="github link" rel="noopener noreferrer" href="http://github.com/broeker/spacebook" target="_blank">
<svg height="28" viewBox="0 0 24 24" fill="none">
<path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z" fill="currentColor"></path>
</svg>
</a>
</div>
<button aria-label="Show navigation" id="sidebar-open-button" class="block md:hidden mr-3">
<svg fill="none" width="24" height="24" viewBox="0 0 24 24" class="text-gray-400 hover:text-gray-600" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</nav>
</header>
<aside
id="sidebar"
class="
hidden md:block
fixed z-10 top-0 left-0 inset-y-0
w-full md:w-60
overflow-y-auto
mt-20 md:mt-20
bg-white dark:bg-gray-900
text-gray-500 dark:text-gray-400
border-r border-gray-100 dark:bg-dark dark:border-gray-800
transition-colors duration-200
"
>
<button name="Close navigation" id="sidebar-close-button" class="float-right justify-end block md:hidden -mr-4 p-6">
<svg xmlns="http://www.w3.org/2000/svg" class="dark:bg-gray-500" width="18" height="18" viewBox="0 0 18 18">
<path class="text-gray-100" d="M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z"></path>
</svg>
</button>
<div class="py-6 pr-6 pl-1">
{{ content | toc | safe }}
</div>
</aside>
<main class="px-4 pt-24 md:pt-28 pb-20 md:pl-60">
<arcicle class="block m-auto max-w-5xl prose lg:prose-lg dark:prose-dark dark:text-gray-100">
{{ content | safe }}
<footer class="flex mt-4">
<div class="ml-auto text-xs">
Updated&nbsp;<time datetime="{{ site.date | isoDate }}">{{ site.date | humanizeDate }}</time>
<a class="ml-2 inline-block no-underline font-normal rounded" target="_blank" href="{{ site.githubUrl }}/edit/{{ site.githubBranch }}/{{ page.inputPath }}">Edit</a>
</div>
</footer>
</article>
</main>
{% set js %}{% include "main.js" %}{% endset %}
<script>
{{ js | safe }}
</script>
</body>
</html>

1
site/src/logo-bg.svg Normal file
View File

@ -0,0 +1 @@
<svg width="710" height="284" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="35" width="710" height="214" rx="16" fill="#fff"/><path d="M43 135l74-31v127l-74-96z" fill="#FF7A00"/><path d="M192 145l-75 30V48l75 97z" fill="#FFB35A"/><path d="M225 177h20v-24h7l13 24h21l-15-27c8-4 13-11 13-21 0-16-11-25-28-25h-31v73zm20-40v-17h7c7 0 11 2 11 9 0 6-4 8-11 8h-7zM318 178c15 0 25-7 27-19h-18c-1 3-5 5-9 5-6 0-9-4-9-9v-1h36v-5c0-17-11-28-27-28-18 0-29 12-29 29s11 28 29 28zm-9-35c0-5 4-8 9-8s9 4 9 8h-18zM353 197h20v-29c3 5 8 10 16 10 11 0 21-10 21-29s-10-28-21-28c-8 0-14 5-16 11v-10h-20v75zm20-48c0-8 3-12 8-12 6 0 9 4 9 12 0 9-3 13-9 13-5 0-8-5-8-13zM419 177h20v-29c0-6 4-10 10-10l7 1v-17l-5-1c-6 0-10 4-12 12h-1v-11h-19v55zM486 178c18 0 29-12 29-28 0-17-11-29-29-29s-29 12-29 29c0 16 11 28 29 28zm0-15c-5 0-8-5-8-14 0-8 3-13 8-13s8 5 8 13c0 9-3 14-8 14zM538 122h-20l15 27-16 28h20l9-18 9 18h20l-16-28 15-27h-19l-9 17-8-17zM593 197c14 0 21-7 24-16l20-59h-21l-9 38h-1l-8-38h-21l19 57v1c-1 3-5 3-10 1l-5 14c4 2 8 2 12 2z" fill="#000"/></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
site/src/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg width="355" height="130" fill="none" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 710 260"><style>.logo-text{color: #000;}@media(prefers-color-scheme:dark){.logo-text{color: #fff;}}</style><path d="M0 124l85-34v145L0 124z" fill="#FF7A00"/><path d="M170 136l-85 34V25l85 111z" fill="#FFB35A"/><path d="M208 181h23v-28h8l15 28h25l-18-32c9-4 15-12 15-24 0-17-13-28-32-28h-36v84zm23-46v-20h8c8 0 13 3 13 10 0 8-5 10-13 10h-8zM315 182c17 0 29-9 31-22h-21c-1 4-5 6-10 6-7 0-10-5-10-11v-1h41v-5c0-20-13-32-32-32s-32 13-32 32c0 21 12 33 33 33zm-10-40c0-5 4-9 10-9 5 0 10 4 10 9h-20zM355 204h23v-34c3 7 9 11 18 11 13 0 25-10 25-32s-13-32-25-32c-10 0-15 5-18 12v-11h-23v86zm22-55c0-9 4-15 10-15 7 0 10 6 10 15s-3 15-10 15c-6 0-10-6-10-15zM430 181h23v-33c0-7 5-12 11-12l9 1v-19l-6-1c-7 0-12 4-14 13h-1v-12h-22v63zM507 182c21 0 33-13 33-33 0-19-12-32-33-32-20 0-33 13-33 32 0 20 13 33 33 33zm0-17c-6 0-9-6-9-16s3-16 9-16 10 6 10 16-4 16-10 16zM567 118h-23l17 31-18 32h23l10-20 11 20h22l-18-32 17-31h-22l-10 19-9-19zM630 204c16 0 23-8 27-18l23-68h-24l-10 43h-1l-10-43h-24l22 65v1c-2 4-6 4-12 2l-5 16 14 2z" fill="currentColor" class="logo-text"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

11
site/src/main.css Normal file
View File

@ -0,0 +1,11 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
scroll-behavior: smooth;
}
.docs-nav a ~ ul {
@apply mt-1 mb-2;
}

BIN
site/src/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
<svg width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 8l7-3v11L2 8z" fill="#FF7A00"/><path d="M15 8l-6 3V0l6 8z" fill="#FFB35A"/></svg>

After

Width:  |  Height:  |  Size: 169 B

View File

@ -0,0 +1,13 @@
{
"name": "Reproxy",
"short_name": "Reproxy",
"icons": [
{
"src": "touch-icon.png",
"sizes": "512x512"
}
],
"background_color": "#ffffff",
"theme_color": "#FF7A00",
"display": "fullscreen"
}

BIN
site/src/public/sharing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

121
site/tailwind.config.js Normal file
View File

@ -0,0 +1,121 @@
const colors = require('tailwindcss/colors')
const { spacing } = require('tailwindcss/defaultTheme')
module.exports = {
mode: 'jit',
purge: ['src/**/*.njk', 'src/**/*.js', '.eleventy.js'],
darkMode: 'media',
theme: {
extend: {
container: {
center: true,
sm: {
with: '100%',
},
},
colors: {
orange: colors.orange,
},
typography: (theme) => ({
DEFAULT: {
css: {
maxWidth: '100%',
paddingLeft: spacing[12],
paddingRight: spacing[12],
color: theme('colors.gray.700'),
'h2,h3,h4': {
'scroll-margin-top': spacing[24],
},
'blockquote p:first-of-type::before': false,
'blockquote p:last-of-type::after': false,
'code::before': false,
'code::after': false,
img: {
margin: spacing[2],
display: 'initial',
},
code: {
wordWrap: 'break-word',
fontWeight: 'normal',
backgroundColor: theme('colors.gray.100'),
color: theme('colors.gray.700'),
paddingTop: spacing[1],
paddingBottom: spacing[1],
paddingLeft: spacing[2],
paddingRight: spacing[2],
borderRadius: spacing[1],
},
},
},
dark: {
css: [
{
color: theme('colors.gray.400'),
'[class~="lead"]': {
color: theme('colors.gray.300'),
},
a: {
color: theme('colors.gray.200'),
},
strong: {
color: theme('colors.gray.200'),
},
'ol > li::before': {
color: theme('colors.gray.400'),
},
'ul > li::before': {
backgroundColor: theme('colors.gray.600'),
},
hr: {
borderColor: theme('colors.gray.300'),
},
blockquote: {
color: theme('colors.gray.300'),
borderLeftColor: theme('colors.gray.600'),
},
h1: {
color: theme('colors.gray.200'),
},
h2: {
color: theme('colors.gray.200'),
},
h3: {
color: theme('colors.gray.200'),
},
h4: {
color: theme('colors.gray.200'),
},
'figure figcaption': {
color: theme('colors.gray.400'),
},
code: {
backgroundColor: theme('colors.gray.700'),
color: theme('colors.gray.200'),
},
'a code': {
color: theme('colors.gray.200'),
},
pre: {
color: theme('colors.gray.300'),
backgroundColor: theme('colors.gray.800'),
},
thead: {
color: theme('colors.gray.200'),
borderBottomColor: theme('colors.gray.400'),
},
'tbody tr': {
borderBottomColor: theme('colors.gray.600'),
},
},
],
},
}),
},
},
variants: {
extend: {
typography: ['responsive', 'dark'],
},
},
plugins: [require('@tailwindcss/typography')],
}

4124
site/yarn.lock Normal file

File diff suppressed because it is too large Load Diff