You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have try the middleware,but it does not work
I find an easy way to handle this,maybe you can change
I copy from https://studygolang.com/articles/25389
crs:=cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // allows everything, use that to change the hosts.AllowCredentials: true,
})
app:=iris.New()
app.Use(crs())
unlike
crs:=cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // allows everything, use that to change the hosts.AllowCredentials: true,
})
v1:=app.Party("/api/v1", crs).AllowMethods(iris.MethodOptions)`
The text was updated successfully, but these errors were encountered:
v1:=app.Party("/api/v1", crs).AllowMethods(iris.MethodOptions) // <- important for the preflight.
There is no other way to register this specific middleware because routes are registered per subdomain, method and path, so AllowMethods.
Don't forget that if you need to override the router behavior and register something before the iris router, you can also use the app.WrapRouter and put the cors code there (that way will not require AllowMethods).
I have try the middleware,but it does not work
I find an easy way to handle this,maybe you can change
I copy from https://studygolang.com/articles/25389
unlike
The text was updated successfully, but these errors were encountered: