Skip to content
/ simproxy Public

simple proxy – example of an application that uses reverse proxy from the standartd library

License

Notifications You must be signed in to change notification settings

beono/simproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GoDoc Go Report Card

About the project

The project is an example of an application that uses reverse proxy from the standartd library.

Why

Let's assume you want to migrate your api from language X to golang. Sometimes it's hard to rewrite everything at once and you want to move some handlers to golang, but use old application as a fallback. I just want to show you that you don't have to use any 3rd-party proxies (like nginx) or write your own proxy logic.

How to use it

The solution is quite simple and straightforward. We use reverse proxy and http server from the standard library.

  • Clone or go get -u github.com/beono/simproxy this project.
  • Run go test && go run main.go to see it in action.

Send a request to http://localhost/hello and you will get a tiny text response.

Send a request to http://localhost:8080/oauth2/v3/certs and you will get a json response. This request was proxied to https://www.googleapis.com/oauth2/v3/certs, because this handler doesn't exist in our new application.

About

simple proxy – example of an application that uses reverse proxy from the standartd library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published