top

Package secure is a middleware for Martini that helps enable some quick security wins.

package main

import (
  "github.com/go-martini/martini"
  "github.com/martini-contrib/secure"
)

func main() {
  m := martini.Classic()

  m.Use(secure.Secure(secure.Options{
    AllowedHosts: []string{"www.example.com", "sub.example.com"},
    SSLRedirect: true,
  }))

  m.Get("/", func() string {
    return "Hello World"
  })

  m.Run()
}

Imports 1 package(s) ΒΆ

  1. github.com/go-martini/martini