Redocly / developer-portal-starter

Starter template for the Redocly developer portal
https://redoc.ly
Other
64 stars 101 forks source link

Feature Request: Allow CORS for search API #143

Open dchisolm opened 2 years ago

dchisolm commented 2 years ago

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

adamaltman commented 2 years ago

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

adamaltman commented 2 years ago

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"

dchisolm commented 2 years ago

Hi Adam,

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

adamaltman commented 2 years ago

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