modulepackage
0.0.0-20220308014546-9bfeae5ddf45
Repository: https://github.com/segmentio/segment-proxy.git
Documentation: pkg.go.dev
# README
segment-proxy
Proxies requests to the Segment CDN and Tracking API. You can run this in your infrastructure (or use it as a reference implementation) and point your clients to use this proxy instead of api.segment.io
or cdn.segment.com
directly.
CLI
Usage of proxy:
-debug
debug mode
-port string
bind address (default "8080")
Usage
Via Source
- Clone the repo
git clone [email protected]:segmentio/segment-proxy.git
. - Run
make build server
.
Via Golang
- Run
go get github.com/segmentio/segment-proxy
. - Run
segment-proxy
.
Via prebuilt binaries.
Download the latest binaries from Github.
Via Docker
- Run
docker run --publish 8080:8080 segment/proxy
.
Library Instructions
# Functions
NewSegmentReverseProxy is adapted from the httputil.NewSingleHostReverseProxy method, modified to dynamically redirect to different servers (CDN or Tracking API) based on the incoming request, and sets the host of the request to the host of of the destination URL.