We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app := freedom.NewApplication() app.Iris().Use(func(ctx iris.Context) { ctx.Header("Access-Control-Allow-Origin", "*") ctx.Header("Access-Control-Allow-Credentials", "true") ctx.Header("Access-Control-Allow-Headers", "*") ctx.Header("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE") if ctx.Method() == "OPTIONS" { ctx.StatusCode(http.StatusOK) return } ctx.Next() }) app.Iris().AllowMethods(iris.MethodOptions)
这样做好像没有解决
The text was updated successfully, but these errors were encountered:
package main func installMiddleware(app freedom.Application) { crs := func(ctx freedom.Context) { ctx.Header("Access-Control-Allow-Origin", "*") ctx.Header("Access-Control-Allow-Credentials", "true") if ctx.Method() == "OPTIONS" { ctx.Header("Access-Control-Allow-Headers", "Access-Control-Allow-Origin,Content-Type") ctx.Header("Access-Control-Max-Age", "86400") ctx.StatusCode(204) return } ctx.Next() } app.InstallMiddleware(crs) }
Sorry, something went wrong.
No branches or pull requests
这样做好像没有解决
The text was updated successfully, but these errors were encountered: