Home > Mobile >  Is it possible to make such a proxy usage?
Is it possible to make such a proxy usage?

Time:10-21

I`m wondering if it is possible to implement following:

I have some service in GO (used for Firebase Cloud Messaging) it uses go package from firebase (firebase.google.com/go/v4) to send messages. This packge sends https requests. And One of them is to https://oauth2.googleapis.com/token to get token. I can't change code in Firebase go-package, but I need to use proxy, that is why before sending message I need to set HTTPS_PROXY environment variable to my proxy address. It works fine.

Now I need to do some automatic tests and I have an emulator that has /token endpoint and return a valid token as response. Is it possible to use some kind of proxy that can redirect https requests to my emulators endpoint so that all requests to https://oauth2.googleapis.com/token should be redirected to my emulators endpoint /token? And another question is there are any possible problems because of HTTPS ? Is it possible to get rid of https and use only http after the proxy?

CodePudding user response:

Found following solution: Firebase Cloud Messaging package uses clone default transport to create http.client under the hood. So we can configure http.DefaultTransport before calling app.Messaging(ctx) and set up any parameters we need (proxy, insecureSkipVerify ...). So no problems at all.

  • Related