Core: Configure router in AddLinkHeaderListener

Created on 14 Nov 2019  路  5Comments  路  Source: api-platform/core

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

bug

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).

All 5 comments

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).

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.

Was this page helpful?
0 / 5 - 0 ratings