incubator-answer
incubator-answer copied to clipboard
CORS Error while trying to use APIs
Is your feature request related to a problem? Please describe. I would like to use answer as a backend and build my own frontend that I can embed in my existing platform. (Basically a custom client/user interface for answer) Possibly related to #127
Describe the solution you'd like I would like a configurable option, which allows answer APIs to be accessed from authorised domains. i.e. enable CORS.
Describe alternatives you've considered Alternative would be to create fork and use only the backend and modify CORS options, not exactly a favourable alternative. I am open to recommendations.
Yeah, that's sounds a good options. I might need to dig in a little bit.
Thanks for considering it!
I am not very fluent with golang, but this official gin middleware might be of help, if we can configure AllowOrigins
with an environment variable or from UI.
If you don't mind the trouble, I have a plan to solve this situation at present.
You can use nginx or other server as a proxy, in this way, you can use your custom frontend page. when the request url if matched /api
, the proxy will request the answer backend.
Thanks @kumfo
That would work. I am using svelte kit though, so it's not a concern for me right now since I made my own API backend on top of answer's API. I don't have to deal with CORS for now. But still, it would be nice to have it as a feature so that we can configure authorised CORS origins.
@mingcheng, Any updates/plans on CORS implementation and making the API list public?