SkillAgentSearch skills...

Reverseproxy

Simple reverse proxy server. Useful for accessing web applications on various servers (or VMs) through a single domain.

Install / Use

/learn @geosoft1/Reverseproxy
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

reverseproxy

version license

Simple reverse proxy server. Useful for accessing web applications on various servers (or VMs) through a single domain.

How it works?

reverseproxy

Just complete the conf.json file and run the server. Example:

{
    "routes": {
        "#": "the pattern / matches all paths not matched by other registered patterns",
        "/": "http://192.168.88.250",
        "/wrong": "192.168.88.250:8080",
        "/upload": "http://192.168.88.250:8080",
        "/hello": "https://192.168.88.250:8090",
        "/static/": "http://192.168.88.250:8080",
        "#/disabled": "192.168.88.250:8080"
    }
}

Getting started

To compile the reverse proxy server use

go build

If you still want just an HTTP reverse proxy, compile with

go build http.go

or for HTTPS

go build https.go

Note that Register function (see main.go, http.go and https.go) have some headers commented. Change as you wish for dealing with applications which need CORS.

Parameters

Name|Description ---|--- -conf|Cache file name, default value cache.json. -http|Listening address and port for HTTP server, default value 8080. -https|Listening address and port for HTTPS server, default value 8090. -https-enabled|Enable HTTPS server. Default false. -verbose|Enable verbose mode for middleware.

Routes

Routes has the folowing structure

 "path":"host"

The path is what you request and the host is what you get. The reverse proxy always add the path to the host (eg. if your host address is example.com then the path / mean example.com/ and /upload mean example.com/upload).

Paths starting with # are comments and are not added to routes.

A path like /name/ match any request starting with name (eg. /api/ match also /api/bla and so on).

Hosts must be a complete url address and port.

Do not repeat the routes because the server will take always the last route to a host.

Testing the server

curl --verbose http://localhost:8080/hello

For HTTPS use

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
curl --insecure --verbose https://localhost:8090/hello

Faq

Why the HTTPS is not enabled by default?

HTTPS server need some valid certificates which you may not have. If you need only a HTTP server is no reason to generate cerificates just to run the program.

Should I use http or https in the host address?

Yes, prefixes are mandatory to tell the server in which chain to put the route. Omitting that will skip the route.

Related Skills

View on GitHub
GitHub Stars63
CategoryDevelopment
Updated2mo ago
Forks5

Languages

Go

Security Score

95/100

Audited on Dec 31, 2025

No findings