dynamicproxy

package module
v0.0.0-...-771c1b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 5 Imported by: 0

README

caddy-web-proxy

A simple proxy server implemented with Caddy

Build

docker buildx build \
-t saladtechnologies/caddy-web-proxy:latest \
--provenance=false \
--output type=docker \
.

Run

docker run \
-p 3000:3000 \
saladtechnologies/caddy-web-proxy:latest

Use

To access https://salad.com/salad-cloud/generative-ai, use the following command:

curl  -X GET \
  'https://localhost:3000/salad-cloud/generative-ai' \
  --header 'Accept: */*' \
  --header 'x-upstream-host: salad.com'

Note, all parts of the request are proxied as-is, including the headers. The only exception is the Host header, which is replaced with the value of the x-upstream-host header.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	UpstreamHostHeader string `json:"upstream_host_header,omitempty"`
}

Proxy is a Caddy module that enables dynamic proxying

func (Proxy) CaddyModule

func (Proxy) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (Proxy) ServeHTTP

func (m Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*Proxy) UnmarshalCaddyfile

func (p *Proxy) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL