x1unix/go-playground

No support for self-signed certs

alexjacobson95 opened this issue · 1 comments

Trying to deploy this on my local infrastructure, I have my own CA which I use to host awesome tools like this at my house. I deployed this behind a TLS offloading proxy and everything loaded up perfectly right up until I hit run and:

fail to send request to playground server POST "<internal-url>/fmt": x509: certificate signed by unknown authority

Looking through the code I am guessing since the front-end is using WASM, even though my browser trusts my CA (I can load the root page without any TLS errors), the WASM binary doesn't have access to the CA file to verify the request.

Not sure the best solution here. I am not familiar enough with WASM to know how to fix this. Normally I would say just make an environment variable that you can load the CA bundle in via docker, but I think the CA bundle actually needs to be compiled into the WASM binary during the image build. Not sure the best way to accomplish that.

If someone points me in the right direction I would be more than happy to try and put a PR up. Thanks for the awesome project!

@alexjacobson95 before executing any code or compiling a WASM binary on server side, you code runs through goimports.

Go imports is handled by a back-end which sends request to original Go playground (see pkg/goplay/client.go:78 ).

You can specify a custom Go playground server URL with APP_PLAYGROUND_URL environment variable (see the wiki)