Skip to content

AnswerDotAI/caddy-http-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caddy-http-router

A Caddy module that routes requests by looking up upstream addresses via HTTP.

Usage

Build Caddy with this module:

xcaddy build --with github.com/AnswerDotAI/caddy-http-router

Configuration

The module extracts the subdomain from incoming requests and calls your lookup service. Your service should return plain text host:port or 404 if not found.

JSON Config

{
  "handler": "http_router",
  "lookup_url": "http://localhost:5002/lookup"
}

Then use with reverse_proxy:

{
  "handler": "reverse_proxy",
  "upstreams": [{"dial": "{http.vars.backend_upstream}"}]
}

Caddyfile

http_router {
    lookup_url http://localhost:5002/lookup
    timeout 1000
}
reverse_proxy {http.vars.backend_upstream}

Options

Option Default Description
lookup_url (required) URL of the lookup service (subdomain appended)
timeout 1000 HTTP timeout in milliseconds

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages