-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - handle CORS for APIs and config allow origin #1792
Comments
I added import "github.com/gin-contrib/cors" and add code in func newAPI in api.go
could dirty solve CORS when call APIs from client-side JavaScript for me. |
I have solved the cors issue using gin-contrib/cors package |
since v1.8.0 there's option |
I tried setting apiAllowOrigin but it did not work. in mediamtx.yml I tried calling the control API from angular frontend but it failed due to CORS Error in the browser console: |
@phadkesharan i tried using the API through an external page with It is not present on non-existing pages or when you call the end point with the wrong method (therefore, you're probably using the wrong method, which in case of the |
I am sure I used the right method (POST) while calling the API
I have enabled origin for control API in mediamtx.yml file
but when I make the request from my frontend application I get the error : |
I was facing the same error when using React on the client side. The best I could do was use Caddy as reverse proxy and add CORS. Caddyfile
caddy run --config Caddyfile Reference is here https://kalnytskyi.com/posts/setup-cors-caddy-2/ |
@aler9 should I create a new issue for addressing this problem ? |
This issue is mentioned in release v1.8.3 🚀 |
Fixed again by #3535 |
This issue is mentioned in release v1.8.4 🚀 |
Describe the feature
currently mediamtx REST api don't handle OPTIONS requests, so CORS will fail, this means web-based apps can't call APIs from client-side JavaScript.
I hope mediamtx can handle browser CORS OPTIONS requests, and the allowed origins can be set in config file
The text was updated successfully, but these errors were encountered: