Johnny
Johnny

Reputation: 133

Setting up a forward proxy on Google cloud run

I'm trying to set up a goproxy server on Google cloud run. The go file with the corresponding Dockerfile below are working flawlessly when I run them locally.

Is something like this possible at all? From my limited understanding of proxies, using the CONNECT method should work over https. What am I missing here?

Go file

package main

import (
    "github.com/elazarl/goproxy"
    "log"
    "net/http"
    "os"
)

func main() {
    proxy := goproxy.NewProxyHttpServer()
    proxy.Verbose = true
    log.Fatal(http.ListenAndServe(":" + os.Getenv("PORT"), proxy))
}

Dockerfile

FROM golang:1.14

WORKDIR /go/src/app
COPY goproxy.go /go/src/app/goproxy.go

RUN cd /go/src/app && go get -d -v .

CMD go run /go/src/app/goproxy.go

Upvotes: 4

Views: 2885

Answers (1)

ahmet alp balkan
ahmet alp balkan

Reputation: 45302

Cloud Run does not support HTTP CONNECT verb.

Your best bet is to make an HTTP reverse proxy (which is not possible with goproxy, or at least I found it to be pretty difficult).

Upvotes: 4

Related Questions