YunoHost-Apps / peertube_ynh

Federated (ActivityPub) video streaming platform using P2P for YunoHost
https://joinpeertube.org/fr/
GNU Affero General Public License v3.0
88 stars 27 forks source link

Videos/Upload Cors Issue #221

Closed zanhesl closed 2 years ago

zanhesl commented 3 years ago

Hello Everyone, suddenly request videos/upload from my local server stopped working because of some CORS issues. However, I am able to upload video from my peertube instance directly. Code worked perfectly a week ago. Do you have any ideas why my code has stopped working?

Errors: image

image

My code:

image

It worked properly before the latest update. I'm currently using 3.1.0 version.

zanhesl commented 3 years ago
Снимок экрана 2021-04-19 в 11 06 35

Adding this to nginx.conf is doing nothing at all

zanhesl commented 3 years ago

After further debugging I've found out that server indeed does not return Access-Control headers

My query:

curl -H "Origin: https://pocketnet.app" -H "Access-Control-Request-Method: POST" -H "Access-Control-Request-Headers: X-Requested-With" -X OPTIONS --verbose https://pocketnetpeertube3.nohost.me/api/v1/videos/upload

result:

Снимок экрана 2021-04-19 в 13 22 55

So how can I update server config?

zanhesl commented 3 years ago

It turned out that new Nginx config does not handle preflight requests on /videos/upload, so REST API is unusable. I could make a PR to solve this (essentially just add OPTIONS handler for /videos/upload route).

yalh76 commented 3 years ago

yes, I let you do a PR ;)

fflorent commented 3 years ago

@zanhesl If you change the server config, what do you think of also proposing a PR for the upstream nginx config file?

https://github.com/Chocobozzz/PeerTube/blob/develop/support/nginx/peertube

yalh76 commented 2 years ago

last peertube nginx is already implemented