mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-30 09:38:26 -05:00
* feat: add CSP and other security related headers in the oCIS proxy service * fix: consolidate security related headers - drop middleware.Secure * fix: use github.com/DeepDiver1975/secure * fix: acceptance tests * feat: support env var replacements in csp.yaml
27 lines
586 B
Go
27 lines
586 B
Go
/*
|
|
Package secure is an HTTP middleware for Go that facilitates some quick security wins.
|
|
|
|
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/unrolled/secure"
|
|
)
|
|
|
|
var myHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
w.Write([]byte("hello world"))
|
|
})
|
|
|
|
func main() {
|
|
secureMiddleware := secure.New(secure.Options{
|
|
AllowedHosts: []string{"www.example.com", "sub.example.com"},
|
|
SSLRedirect: true,
|
|
})
|
|
|
|
app := secureMiddleware.Handler(myHandler)
|
|
http.ListenAndServe("127.0.0.1:3000", app)
|
|
}
|
|
*/
|
|
package secure
|