Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 1.34 KB

README.md

File metadata and controls

19 lines (16 loc) · 1.34 KB

reverse-proxy-sni

This is a simple example of a reverse proxy that uses HTTPS and SSL SNI writen in go

Running in a docker container

  1. Generate the certificates running the initKey.sh script. This script also modifies /etc/hosts, so it needs to be run as sudo
  2. Now you can use docker-compose. To check out the reverse proxy, run docker-compose up. It'll create a docker image and start
  3. Go to the browser and access https://localhost1:8000 and https://localhost2:8000
  • By default the reverse proxy on docker listen on port 8000 and the backend servers on 8080 and 8081

Running without docker

  1. Repeat the first instruction above to generate the certificates
  2. go run proxy/proxy.go to run the reverse proxy
  3. go run service1/app.go and go run service2/app.go to run the backend services
  4. Go to the browser and access https://localhost1:8000 and https://localhost2:8000

Configuration file

This project uses config.yaml as input to specify port for reverse proxy and path to certificates

Running tests

  1. go test ./proxy -v