irods / irods_client_http_api

An iRODS C++ HTTP API using Boost.Beast
BSD 3-Clause "New" or "Revised" License
0 stars 6 forks source link

CORS headers #245

Open ll4strw opened 5 months ago

ll4strw commented 5 months ago

I am testing a JavaScript/JQuery app to interact with the API endpoints. In particular, I noticed that the authenticate endpoint response (and all other endpoint responses also?) misses the CORS header ‘Access-Control-Allow-Origin’, which causes my AJAX call to fail (the app runs on a different domain than the API server). Would it be possible to add a conf option that lets an admin set ad hoc response headers?

korydraughn commented 5 months ago

We are certainly looking into that. The current options are:

Using a HTTP proxy offers the most flexibility and works today. Until we make a decision on this, please use a proxy.

We used nginx in the past. That should work perfectly for your needs. You can use the C++ REST API's nginx reverse proxy configuration as a reference.

The instructions for that file can be found here.

ll4strw commented 5 months ago

Thanks for the prompt reply. Indeed, option 2 is the better one for production envs, but 1 is useful for testing purposes.

korydraughn commented 5 months ago

We'll leave this open until a decision is made.