🐛 [Bug]: CORS middleware should ignore config AllowedOrigins when AllowedOriginsFunc is defined #2770
Closed
3 tasks done
Labels
8000
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: