Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/iris-contrib/middleware/cors"
|
||||
"github.com/kataras/iris/v12/context"
|
||||
)
|
||||
|
||||
// CrsAuth
|
||||
func CrsAuth() context.Handler {
|
||||
return cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"}, // allows everything, use that to change the hosts.
|
||||
AllowedMethods: []string{"POST", "GET"},
|
||||
AllowedHeaders: []string{"*"},
|
||||
ExposedHeaders: []string{"Accept", "Content-Type", "Content-Length", "Accept-Encoding", "X-CSRF-Token", "Authorization"},
|
||||
AllowCredentials: true,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/iris-contrib/middleware/secure"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// LoadTls
|
||||
func LoadTls() iris.Handler {
|
||||
middleware := secure.New(secure.Options{
|
||||
SSLRedirect: true,
|
||||
SSLHost: "127.0.0.1:443",
|
||||
})
|
||||
return middleware.Handler
|
||||
}
|
||||
Reference in New Issue
Block a user