Video upload - Unknown error

dear,

since a while i try my best to ge peertube to work at some way, but stuck in video upload with unknown error, have no idea what to do more!
latest peertube instance on ubuntu lts 20.04, no chanse to upload a smal 10 mb video…

no error logs, just some access logs:
####################################################
{« tags »:[« http »],« level »:« info »,« message »:"192.168.1.1 - - [24/May/2022:18:31:21 +0000] « POST /api/v1/videos/upload-resumable HTTP/1.0 » 201 - « https my domain com:4443/videos/upload » « Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36" »,« label »:« server.kobiela.no:4443 »,« timestamp »:« 2022-05-24T18:31:21.708Z »}
####################################################

on: var/log/nginx/error.log
-2022/05/24 17:46:33 [notice] 13550#13550: signal process started

update: (just did an reboot on my lts ubuntu 20.04 server

on: var/log/nginx/peertube.error.log

####################################################
2022/05/24 19:17:01 [error] 966#966: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: [my domain com], request: « GET /socket.io/?accessToken=dfca1dd9fb4c29dd5a11e6f6dd1d01f052ad14b8&EIO=4&transport=polling&t=O3tW4Xs HTTP/2.0 », upstream: « http 127.0.0.1:9000/socket.io/?accessToken=dfca1dd9fb4c29dd5a11e6f6dd1d01f052ad14b8&EIO=4&transport=polling&t=O3tW4Xs », host: « my.domain.com:4443 », referrer: « https my domain com:4443/videos/upload »
####################################################

thats it, no more log info to show, how ever, im thankful for help !

i did check my browser error and it shows:

Access to XMLHttpRequest at ‹ https my domain com/api/v1/videos/upload-resumable?upload_id=370cabd5-5a9258ea-e148043e-6108ed94 › from origin ‹ https my domain :4443 › has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‹ Access-Control-Allow-Origin › header is present on the requested resource.

that should give more info, how to edit my config to get my uploads now working ?

It seems you are using a non-standard https port (4443). It appears in some logs, and not in others. Maybe you configured the wrong url somewhere? (without the port)

dear

peertube has 2 places to config url, probably just 1 the config file, and nginx sites-/ file thats it, so there is an api that do handle my port wish ( 4443) not the way it should, whits api / config ?

i did open an issue case for that because an simple port change on peertube is probably not posible… so maybe an dev. can tel me what to comment out or what to modifie to get port 4443 included in cors

Have you 4443 on this line of your production.yaml file?

dear,

yes, sure i did :slight_smile: tube config and nginx config are setup and and working fine, i did edit also:
////
/var/www/peertube/versions/peertube-v4.1.1/dist/server/controllers/api/oauth-clients.js
////
to avoid oauth issues (ports need to be edited to be able to login)

i got some help on git to edit proxy parts like that:
////
proxy_set_header Host $http_host; or proxy_set_header Host $host:$server_port;
////

how ever, this makes oauth loopback to old status and login becomes imposible :confused:

Good News!
@kukhariev did the magic edit on the server site, let me past a copy of my 5 cent:

For other Peertube users try to figure out what to do after changing ports on Peertube instances, try to:

Add:
useRelativeLocation: true inside uploadx.js betw. line 7 - 8
Destination
/var/www/peertube/versions/peertube-v4.1.1/dist/server/lib/uploadx.js

comment out: or copy - past @ Line 18 - 20
#####################################
/if (serverPort !== 8080 && serverPort !== 4443) {
headerHostShouldBe += ‹ : › + serverPort;
}/

#####################################
Destination
/var/www/peertube/versions/peertube-v4.1.1/dist/server/controllers/api/oauth-clients.js

Edit Ports:
Nginx:
/etc/nginx/sites-available/your.domain.com
or /etc/nginx/sites-available/peertube

PeerTube
/var/www/peertube/config/production.yaml

Hope that helps any no coders at some way

Thanks For helping me and other peertube users!

Hi @vontanix

I tried this settings.
After changing oauth-clients.js it worked for login.
But « unknown error » on upload persist (I just tried useRelativeLocation: true inside uploadx.js).