Skip to content

Instantly share code, notes, and snippets.

@Sammuel09
Last active July 10, 2020 14:04
Show Gist options
  • Save Sammuel09/008cbb63d88d4c4f5ac9fa9ce85c807c to your computer and use it in GitHub Desktop.
Save Sammuel09/008cbb63d88d4c4f5ac9fa9ce85c807c to your computer and use it in GitHub Desktop.
This is a reverse-proxy server for statement backend
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
mux := http.NewServeMux()
mux.Handle("/", httputil.NewSingleHostReverseProxy(&url.URL{
Scheme: "http",
Host: "localhost:3002", // if the service is running on localhost:3000
}))
fmt.Printf("listening on https://statement.samuel.dev.brank.as:9443")
http.ListenAndServeTLS("localhost:9443", "samuel.dev.brank.as+5.pem", "samuel.dev.brank.as+5-key.pem", mux)
}
@Sammuel09
Copy link
Author

the .pem files are the certificate files. Any valid certificate you generate should suffice, just make sure it matches. Also, save the .pem files in the same folder as the main.go file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment