Get scheme of the current request URL
<p>In Ruby/Rack, I'm able to <a href="http://www.rubydoc.info/gems/rack/Rack/Request/Helpers#scheme-instance_method" rel="noreferrer">get the scheme of the current request URL from <code>scheme#request</code></a>. However, in Go, <a href="https://golang.org/pkg/net/http/#Request" rel="noreferrer"><code>http.Request.URL.Scheme</code></a> returns an empty string:</p>

<pre><code>package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe(":8080", nil))
}

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "%#v\n", r.URL.Scheme) // Always shows empty string
}
</code></pre>

<p>How do I get scheme of the current request URL?</p>