Skip to content

patientsknowbest/pg-rewrite-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg-rewrite-proxy

A reverse proxy for postgres which rewrites queries.

Arbitrary rewriting is supported by supplying an LUA script to the proxy application, with 'rewriteQuery' and 'rewriteParse' functions for rewriting the query. Note the latter is used for the extended query protocol. Rewriting query parameters supplied with Bind is not yet supported.

Failure to rewrite the query will raise a NOTICE but it will not cause an error.

All other messages than Query are passed to the upstream unmodified. SSL connections are not supported.

Binaries for linux amd64 and arm64 are available on the releases page. For other architectures please build from source.

Prerequisites:

  • Go 1.17 or greater

Build from source:

CGO_ENABLED=0 go build -o pg-rewrite-proxy cmd/main.go

Usage:

./pg-rewrite-proxy --help