25 lines
550 B
Go
25 lines
550 B
Go
|
package routes
|
||
|
|
||
|
import "net/http"
|
||
|
|
||
|
// HTTPSRedirect is a connection handler which redirects all HTTP requests to HTTPS
|
||
|
type HTTPSRedirect struct {
|
||
|
}
|
||
|
|
||
|
func (red *HTTPSRedirect) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||
|
w.Header().Set("Connection", "close")
|
||
|
dest := "https://" + req.Host + req.URL.Path
|
||
|
if len(req.URL.RawQuery) > 0 {
|
||
|
dest += "?" + req.URL.RawQuery
|
||
|
}
|
||
|
http.Redirect(w, req, dest, http.StatusTemporaryRedirect)
|
||
|
}
|
||
|
|
||
|
// Temporary stubs for view tracking
|
||
|
func DynamicRoute() {
|
||
|
}
|
||
|
func UploadedFile() {
|
||
|
}
|
||
|
func BadRoute() {
|
||
|
}
|