if your service is behind some TLS terminating hop then you could also inspect the X-Forwarded-Proto header if available.
On Thursday, 1 March 2012 23:54:10 UTC+1, Andrew Gerrand wrote: > > On 1 March 2012 22:06, Johann Höchtl <johann....@gmail.com <javascript:>> > wrote: > > > > but req.URL is constructed by parsing the Request-URI on the first line > of > > the HTTP request. That > >> > >> typically looks something like > >> GET /foo.html HTTP/1.0 > >> which is, of course, a rather limited URL. It has no schema, host, > >> port, query or fragment, which is why those things won't appear in > >> req.URL. > > > > Thank you, that's why I am asking here before. I thought I can use the > > URL.Schema to programmatically assemble a redirect handler without > knowing > > if I have to use http or https. > > You can test if a given *http.Request (req) is https connection like so: > > isHTTPS := req.TLS != nil > > Andrew > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.