Closed as not planned
Description
Go version
go version go1.22.5 linux/amd64
Output of go env
in your module/workspace:
O111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/xray/.cache/go-build'
GOENV='/home/xray/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/xray/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/xray/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/snap/go/10660'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/snap/go/10660/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/home/xray/tmp/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build996338008=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Sample program running on server:
package main
import (
"fmt"
"net/http"
)
type proxy struct {}
func (s *proxy) ServeHTTP(w http.ResponseWriter, req *http.Request) {
fmt.Println("Requested URL:", req.URL.String())
w.Write([]byte("OK"))
}
func main() {
p := &proxy{}
err := http.ListenAndServeTLS(":443", "r.fullchain.pem", "r.privkey.pem", p)
if err != nil {
panic("ListenAndServe")
}
}
Then I using it as proxy with CURL:
curl -vvv --proxy-http2 -x https://example.server:443 http://remote.host/path
* Host example.server:443 was resolved.
* IPv6: (none)
* IPv4: 1.2.3.4
* Trying 1.2.3.4:443...
* Connected to example.server (1.2.3.4) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_CHACHA20_POLY1305_SHA256 / X25519 / RSASSA-PSS
* ALPN: server accepted h2
* Proxy certificate:
* subject: CN=example.server
* start date: May 16 03:00:12 2024 GMT
* expire date: Aug 14 03:00:11 2024 GMT
* subjectAltName: host "example.server" matched cert's "example.server"
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify ok.
* Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha256WithRSAEncryption
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* [HTTP/2] [1] OPENED stream for http://remote.host/path
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: http]
* [HTTP/2] [1] [:authority: remote.host]
* [HTTP/2] [1] [:path: /path]
* [HTTP/2] [1] [user-agent: curl/8.5.0]
* [HTTP/2] [1] [accept: */*]
> GET http://remote.host/path HTTP/2
> Host: remote.host
> User-Agent: curl/8.5.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/2 200
< content-type: text/plain; charset=utf-8
< content-length: 2
< date: Wed, 10 Jul 2024 04:26:39 GMT
<
* Connection #0 to host example.server left intact
What did you see happen?
Example program prints:
Requested URL: /path
What did you expect to see?
Example program expected to print:
Requested URL: http://remote.host/path
Metadata
Metadata
Assignees
Labels
No labels