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 tried to set the CORS config AllowedOriginsFunc to define my custom logic for Origin header handling. The response always returned * in the Access-Control-Allow-Origin header. I expected the header to contain the origin allowed by the AllowedOriginFunc config I defined before.
I checked the code and found that the AllowedOrigins config was set to * when it was empty, which IMO is not required if the AllowedOriginsFunc config is already defined. When the user sets the AllowedOriginsFunc then they should know that the AllowedOrigins config will not be used or ignored.
I think this is a bug and should be fixed. I can make time for it. Let me know if you think otherwise. Thank you.
How to Reproduce
Set CORS middleware with onlyAllowedOriginsFunc config defined.
The preflight (OPTIONS) request will always return Access-Control-Allow-Origin header with value *.
Expected Behavior
The middleware should return Access-Control-Allow-Origin header with a value containing the origin allowed by AllowedOriginsFunc config instead of *.
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
Bug Description
I tried to set the CORS config
AllowedOriginsFunc
to define my custom logic forOrigin
header handling. The response always returned*
in theAccess-Control-Allow-Origin
header. I expected the header to contain the origin allowed by theAllowedOriginFunc
config I defined before.I checked the code and found that the
AllowedOrigins
config was set to*
when it was empty, which IMO is not required if theAllowedOriginsFunc
config is already defined. When the user sets theAllowedOriginsFunc
then they should know that theAllowedOrigins
config will not be used or ignored.I think this is a bug and should be fixed. I can make time for it. Let me know if you think otherwise. Thank you.
How to Reproduce
AllowedOriginsFunc
config defined.Access-Control-Allow-Origin
header with value*
.Expected Behavior
The middleware should return
Access-Control-Allow-Origin
header with a value containing the origin allowed byAllowedOriginsFunc
config instead of*
.Fiber Version
2.49.2
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: