Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
self signed https localhost proxy with golang
copied from https://devcenter.heroku.com/articles/ssl-certificate-self
install go and openssl
mac os x: brew install go openssl
Generate private key and certificate signing request
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
start the proxy
go run httpsproxy.go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
localProxyUrl, _ := url.Parse("http://127.0.0.1:8100/")
localProxy := httputil.NewSingleHostReverseProxy(localProxyUrl)
http.Handle("/", localProxy)
log.Println("Serving on localhost:8080")
log.Fatal(http.ListenAndServeTLS(":8080", "server.crt", "server.key", nil))
}
@siliconcow

This comment has been minimized.

Copy link

commented Feb 23, 2017

How do you tell ionic run to configure the app to use the proxy?

@ronaiza-cardoso

This comment has been minimized.

Copy link

commented Jul 21, 2017

@siliconcow I have this question too, do you have any light about that?

@lolgans

This comment has been minimized.

@NinoSkopac

This comment has been minimized.

Copy link

commented Jul 11, 2018

worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.