http-gate
Version, currently 0.3.36 versions
github.com/maiha/http-gate
Quite simple http port forwarder
Installation
# Add this to your shard.yml
dependencies:
http-gate:
github: maiha/http-gate
version: ~> 0.3.3Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- maiha
- Targets
http-gatefrom src/bin/http-gate.crhttp-gate-devfrom src/bin/http-gate.cr
Dependencies
Runtime Dependencies
README
http-gate 
Quite simple http port forwarder.
Installation
Get x86_64 static binary from releases.
Usage
For example, listens '0.0.0.0:8080' and forwards by paths as follows.
0.0.0.0:8080
/ch/* => 127.0.0.1:8123/*
/* => 127.0.0.1:9001/*
[front]
host = "0.0.0.0"
port = 8080
[[back]]
path = "/ch"
port = 8123
remove_path = true
[[back]]
path = "/"
port = 9001
[logger]
path = "STDOUT"
colorize = true
$ http-gate -c config.toml
I [11:43:30] F Add [Back#0] '/ch/' => 127.0.0.1:8123
I [11:43:30] F Add [Back#1] '/' => 127.0.0.1:9001
I [11:43:30] F Listening on http://0.0.0.0:8080
Static File
[[back]]
type = "static"
path = "/public"
dir = "/var/www/html"
remove_path = true
autoindexis not implemented yet.
Template File
This just embeds ENV and HTTP::Request::Headers variables into {{type:xxx}}.
Here, type is one of env or req.
[[back]]
type = "template"
dir = "/var/www/html"
For example, a html file
DIR: {{env:PWD}}
IP: {{req:X-FORWARDED-IP}}
will be converted to
DIR: /var/www
IP: 192.168.0.1
404
If the template file is not found, the filename specified by the 404 option is used as the template. If no option is provided, a 404 error will occur.
[[back]]
type = "template"
dir = "/var/www/html"
"404" = "404.html"
/var/www/html
+-- 404.html
Since the request path is in req:PATH, you can easily create a redirect site by using the following static template file
Redirecting ... <a href="https://some.example.com{{req:PATH}}">some.example.com{{req:PATH}}</a>
Config
Show a sample of config.
$ http-gate --sample
Development
- needs crystal-0.27.0
$ make
Contributing
- Fork it (https://github.com/maiha/http-gate/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- maiha maiha - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.3.3- Tagged
- Sep 28, 2022
- Commit
a60a57edba05- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/maiha/http-gate
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 6