Add CORS support#1128
Conversation
|
I'm working on an alternative web-based frontend and also had a need for the Linkding API to return CORS headers. I just tested this PR and it works great (at least for my use case). |
|
Rebased against |
|
@sissbruecker is CORS support something that you think could be accepted, assuming the implementation was able to meet the appropriate standards? Are there concerns about adding a new dependency (django-cors-headers), the (too?) many configuration options, or something else? Thanks! |
|
Those would indeed be the main concerns. It adds a lot of rather technical options and requires a new dependency for something that is not really needed by the majority of users. Apart from that I haven't really had the time or motivation to engage with this, partly also because I see little value in it compared to other things I could do (or that interest me more I guess). But I tend to change my mind so maybe I'll proceed with this at some point. |
|
@abatkin How about only having For example, could we remove On a related note, does it really make sense to have Isn't I also wonder whether Similarly, could we just choose a sensible default for |
|
I think that's reasonable - only allowing The next question is whether it makes sense to use the https://pypi.org/project/django-cors-headers/ third-party library, or to build the functionality directly into the app. I'm fine implementing from scratch, the CORS standard isn't not a moving target at this point. |
Add CORS support to linkding. This is useful if you are running an alternate web-based frontend. By default, all CORS support is disabled, but once one of the documented environment variables are set, an additional Django middleware (django-cors-headers) is added and configured appropriately.
This change:
django-cors-headers(which adds no additional net-new transitive dependencies)