chickenlj commented on issue #2642:
URL: https://github.com/apache/dubbo-go/issues/2642#issuecomment-2024297058

   Solution by @2456868764 in https://github.com/apache/dubbo-go/pull/2643
   
   ```go
   setHTTPSHeaders := func(h http.Handler) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                // Set http scheme header
                r.Header.Set(":x-scheme", "https")
                r.Header.Set(":x-host", r.Host)
                r.Header.Set(":x-path", r.RequestURI)
                r.Header.Set(":x-method", r.Method)
                certs := r.TLS.PeerCertificates
                if len(certs) > 0 {
                        peerCert := certs[0]
                        if len(peerCert.URIs) > 0 {
                                spiffeURI := peerCert.URIs[0].String()
                                // Set spiffe scheme header
                                r.Header.Set(":x-spiffe", spiffeURI)
                        }
                }
                h.ServeHTTP(w, r)
        })
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to