API Platform version(s) affected: 2.*
Original issue: https://github.com/nelmio/NelmioCorsBundle/issues/115
Discussion: https://github.com/nelmio/NelmioCorsBundle/pull/125#issuecomment-553864425
Solution: we should handle the router context in the AddLinkHeaderListener to fix the original issue
I don鈥檛 think we should introduce such logic in API Platform to prevent a side-effect caused by a third party library. The problem should be fixed in NelmioCors (and it can affect other libraries).
Doesn't https://github.com/nelmio/NelmioCorsBundle/pull/125#issuecomment-553848344 solve the problem?
Already discussed here: the fix proposal in NelmioCors was refused. Everybody argued that it should be fixed on ApiPlatform...
I didn't find any explicit response to the fix you suggested, but anyway, I'd say it's wrong for CorsListener to break the request context on every OPTIONS request. OPTIONS is an important HTTP ~verb~ method (I mean, all HTTP verbs are important lol :see_no_evil:), it's not only used for CORS preflight requests.
Most helpful comment
I don鈥檛 think we should introduce such logic in API Platform to prevent a side-effect caused by a third party library. The problem should be fixed in NelmioCors (and it can affect other libraries).