developer-portal-starter icon indicating copy to clipboard operation
developer-portal-starter copied to clipboard

Feature Request: Allow CORS for search API

Open dchisolm opened this issue 4 years ago • 4 comments

In order to better support integration with other documentation sites, it would be beneficial to be able to selectively allow CORS requests to the search API such as https://api.docs.cpanel.net/search-index.json?q=mysql&l=100.

We would accept being able to add it to our developer portal via code/configuration if possible, however if I am recalling correctly, this portion of the application is already bundled and not easily edited?

The lack of CORS support is blocking some important integrations for us currently. Any direction that you can provide would be appreciated.

Thanks

dchisolm avatar Sep 29 '21 17:09 dchisolm

What origin (domain) do you want to call that search index from?

adamaltman avatar Sep 30 '21 01:09 adamaltman

And you're not planning to call it from a server? You can like this:

curl "https://api.docs.cpanel.net/search-index.json?q=mysql&l=100"

adamaltman avatar Sep 30 '21 01:09 adamaltman

Hi Adam,

This is being called in front-end javascript. IE from sites like https://docs.cpanel.net/.

dchisolm avatar Sep 30 '21 19:09 dchisolm

You could access it through a CORS proxy. We might be able to enable CORS -- we need to consider any security implications. Is there an exhaustive list of sites which would be calling it? Or is it limited to a few domains (or even better, only subdomains of cpanel.net)?

adamaltman avatar Sep 30 '21 20:09 adamaltman