`redirector` is dynamic configurable HTTP-redirection service.
2.4K
redirectorredirector is dynamic configurable HTTP-redirection service.
Supported store engine:
memory (not store configuration between restarts)redis (now support only single-server configuration)Supported match / resolve algorithm:
simple (full match of host and path, not change target)pattern (full match host, match path by regexp, replace target placeholders by pattern groups)curlIf we have: source ^/(.)$ and target path https://example.org/promocode/{0}.
Then request to path /PROMOCODE resolved to https://example.org/promocode/PROMOCODE.
Not yet used in production.
go (tested on version 1.10)make# Install development dependencies
make dev-deps
# Install runtime dependencies
make deps
# Generate swagger files
make gen-swagger
make lint
make run-test
make bin/redirector-server
# Build image
docker build -t redirector .
# Run container
docker run -p 8080:8080 redirector
Show usage with command:
./bin/redirector-server --help
Usage:
redirector-server [OPTIONS]
Redirector configure API
Application Options:
--scheme= the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec
--cleanup-timeout= grace period for which to wait before shutting down the server (default: 10s)
--max-header-size= controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of
the request body. (default: 1MiB)
--socket-path= the unix socket to listen on (default: /var/run/redirector.sock)
--host= the IP to listen on (default: localhost) [$HOST]
--port= the port to listen on for insecure connections, defaults to a random value [$PORT]
--listen-limit= limit the number of outstanding requests
--keep-alive= sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download) (default: 3m)
--read-timeout= maximum duration before timing out read of the request (default: 30s)
--write-timeout= maximum duration before timing out write of the response (default: 60s)
--tls-host= the IP to listen on for tls, when not specified it's the same as --host [$TLS_HOST]
--tls-port= the port to listen on for secure connections, defaults to a random value [$TLS_PORT]
--tls-certificate= the certificate to use for secure connections [$TLS_CERTIFICATE]
--tls-key= the private key to use for secure conections [$TLS_PRIVATE_KEY]
--tls-ca= the certificate authority file to be used with mutual tls auth [$TLS_CA_CERTIFICATE]
--tls-listen-limit= limit the number of outstanding requests
--tls-keep-alive= sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)
--tls-read-timeout= maximum duration before timing out read of the request
--tls-write-timeout= maximum duration before timing out write of the response
store:
-s, --store-type=[memory|redis] Type of store engine (default: memory)
--redis-uri= Connection URI for Redis. Required if store-type equal redis
--redis-pool-size= Redis pool size (default: 10)
-u, --basic-username= Username for Basic auth [$BASIC_USERNAME]
-p, --basic-password= Password for Basic auth. [$BASIC_PASSWORD]
Help Options:
-h, --help Show this help message
Logger level can be configured with ennvar LOG_LEVEL.
Allowed values:
Content type
Image
Digest
Size
6.7 MB
Last updated
about 8 years ago
docker pull c0va23/redirector