Socket
Book a DemoInstallSign in
Socket

github.com/nicolaspearson/gogo-cors-proxy

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/nicolaspearson/gogo-cors-proxy

Source
Go
Version
v0.0.0-20180918160120-d34c299f12ad
Version published
Created
Source

Go Go Cors Proxy

A simple Go proxy which adds CORS headers to an incoming request. This allows your application to execute requests on a resource hosted on a different domain.

Getting Started

  • Download and install Go
  • Setup your $GOROOT and $GOPATH in your bashrc / zshrc, for example:
    export GOROOT=/usr/local/go
    export GOPATH=/dev/go
    export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Application Flags

FlagDefaultDescription
targetlocalhost:8080host:port to proxy requests to
listenlocalhost:8181host:port to listen on
protocolhttpprotocol used by the target
hostlocalhost:3000host header to be used for the proxy request
originhttp://localhost:3000origin header to be used for the proxy request
methodstrueenable / disable default access control methods
debugfalseenable / disable debug messages

Running The Application

Once Go has been correctly installed and configured, execute:

go run proxy.go -target=0.0.0.0:8080 -listen=0.0.0.0:8181 -host=localhost:3000 -origin=http://localhost:3000

Now all incoming requests on port 8181 will be proxied to http://0.0.0.0:8080

Docker

The Docker image is hosted on Docker Hub

Using The Docker Image

Please see the docker-compose.yml file for an example of how the image may be used.

Building The Docker Image

To build the docker image you can simply run: docker-compose up

Contribution Guidelines

Pull Requests

Here are some basic rules to follow to ensure timely addition of your request:

  • Match coding style (braces, spacing, etc.).
  • If it is a feature, bugfix, or anything please only change the minimum amount of code required to satisfy the change.
  • Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  • Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  • Check for existing issues first, before filing a new issue.

License

MIT License

FAQs

Package last updated on 18 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts