Closed
Description
Bug Description
When using the CSRF middleware the cookie is lost if the route uses a Proxy.
When using the Session middleware](https://docs.gofiber.io/next/middleware/session) cookies are kept when using a Proxy.
How to Reproduce
Specified in a small snippet of the code.
Expected Behavior
Response must contains Set-Cookie: csrf_=
header, because if I use a proxy to serve a static SPA application, then this application cannot make POST requests to the API, since the browser does not receive csrf_
cookie.
Fiber Version
v3.0.0-beta.4
Code Snippet (optional)
package main
import (
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/csrf"
"github.com/gofiber/fiber/v3/middleware/proxy"
"github.com/gofiber/fiber/v3/middleware/session"
)
func main() {
app := fiber.New()
sessionMiddleware, sessionStore := session.NewWithStore()
app.Use(sessionMiddleware)
app.Use(csrf.New(csrf.Config{
Session: sessionStore,
}))
app.Get("/", func(c fiber.Ctx) error {
return proxy.Do(c, "https://localhost:7000")
})
app.Listen(":8000")
}
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my problem prior to opening this one.
- I understand that improperly formatted bug reports may be closed without explanation.
Metadata
Metadata
Assignees
Type
Projects
Status
Done