AVideo icon indicating copy to clipboard operation
AVideo copied to clipboard

Ajax error on remote encoders only since encoder updates

Open para2022 opened this issue 1 year ago • 44 comments

Hi i have an ajax error on the remote encoders which doesn't affect the local encoder.

Videos still encode but this ajax error is blocking the popup to add additional features what was added recently. The popup only works on the local encoder which doesnt have the ajax error.

Screenshot 2024-01-06 at 20 44 52

para2022 avatar Jan 06 '24 22:01 para2022

this will not stop the upload, but this is something in your streamer server. something related to the apache headers and cors configuration.

I cannot tell you what exactly is.

DanielnetoDotCom avatar Jan 08 '24 13:01 DanielnetoDotCom

Uploads are not possible now since your update yesterday. I get cors error and uploads get stuck in the remote encoders. Before you blame it on my setup the encoders worked fine until you updated them now they do not work. The encoders worked even with the ajax error but now they dont. I do not have a clue how to fix cors errors when my setup was fine and i do not want to start messing with my servers and break them for an issue that has just been created.

para2022 avatar Jan 09 '24 10:01 para2022

I just sent a streamer update, please check

DanielnetoDotCom avatar Jan 09 '24 13:01 DanielnetoDotCom

Ah thats fix it they are working again now the remote ones. Any idea where ajax error is coming from? Only happens when using the encoders remotely but if i use them all locally there is no ajax error. This didnt used to happen. The ajax error blocks the new popup on the encoders. It happens where the popup should occur. cheers

para2022 avatar Jan 09 '24 13:01 para2022

The ajax is something related to the apache headers and cors

DanielnetoDotCom avatar Jan 09 '24 13:01 DanielnetoDotCom

getTimes.json.php blocked   Access-Control-Allow-Origin Multiple Values https://encoder1.ourtube.co.uk, *
status blocked   Access-Control-Allow-Origin Multiple Values https://encoder1.ourtube.co.uk, *

Any clue? my cors looks fine and i dont any problems with other sites that use cors policy just the AVideo setup

para2022 avatar Jan 09 '24 14:01 para2022

This are my errors when i load the encoder page in the developers tools.

Access to XMLHttpRequest at 'https://ourtube.co.uk/objects/getTimes.json.php' from origin 'https://encoder1.ourtube.co.uk' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'https://encoder1.ourtube.co.uk, *', but only one is allowed. script.js:2020

   GET https://ourtube.co.uk/objects/getTimes.json.php net::ERR_FAILED 200 (OK)

send @ jquery.min.js:2 ajax @ jquery.min.js:2 getServerTime @ script.js:2020 (anonymous) @ script.js:2897 e @ jquery.min.js:2 t @ jquery.min.js:2 setTimeout (async) (anonymous) @ jquery.min.js:2 c @ jquery.min.js:2 fireWith @ jquery.min.js:2 fire @ jquery.min.js:2 c @ jquery.min.js:2 fireWith @ jquery.min.js:2 ready @ jquery.min.js:2 B @ jquery.min.js:2 Show 12 more frames Show less encoder1.ourtube.co.uk/:1 Access to XMLHttpRequest at 'https://ourtube.co.uk/status' from origin 'https://encoder1.ourtube.co.uk' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'https://encoder1.ourtube.co.uk, *', but only one is allowed. (index):1089

   GET https://ourtube.co.uk/status net::ERR_FAILED 200 (OK)

send @ jquery.min.js:2 ajax @ jquery.min.js:2 (anonymous) @ (index):1089 e @ jquery.min.js:2 t @ jquery.min.js:2 setTimeout (async) (anonymous) @ jquery.min.js:2 c @ jquery.min.js:2 fireWith @ jquery.min.js:2 fire @ jquery.min.js:2 c @ jquery.min.js:2 fireWith @ jquery.min.js:2 ready @ jquery.min.js:2 B @ jquery.min.js:2 Show 12 more frames Show less

para2022 avatar Jan 09 '24 14:01 para2022

maybe you are setting Access-Control-Allow-Origin somewhere else in your apache config

DanielnetoDotCom avatar Jan 09 '24 14:01 DanielnetoDotCom

No ive been through everywhere on apache in virtual hosts and main conf and nothing, it is doing my nut in. Nothing in my .htaccess either its so wierd. I will keeping digging though.

para2022 avatar Jan 09 '24 14:01 para2022

Its just the avideo site i need to be looking not the encoder servers?

para2022 avatar Jan 09 '24 14:01 para2022

Found the issue....root .htaccess. Note the hash disabling the cors and now it works.

Set Access-Control-Allow-Origin for multiple file types

<FilesMatch "\.(php|ico|pdf|flv|jpg|jpeg|png|gif|swf|ts|webp|mp3|mp4|woff2|css|html|htm|key|m3u8)$">

Header set Access-Control-Allow-Origin "*"

</FilesMatch>

para2022 avatar Jan 09 '24 14:01 para2022

replace:

Header set Access-Control-Allow-Origin "*"

with:

Header always set Access-Control-Allow-Origin "*"

Job done. fixed.

para2022 avatar Jan 09 '24 14:01 para2022

Dan i have one last bug with the new encoder popup. On the remote servers when i can click save the box stays open but it closes on the local server. Can you help with this please? I dont see any errors whatsoever in my dev tools now for the first time ever. Im using the avideonetwork. Thanks

para2022 avatar Jan 09 '24 15:01 para2022

Found the issue....root .htaccess. Note the hash disabling the cors and now it works.

Set Access-Control-Allow-Origin for multiple file types

<FilesMatch "\.(php|ico|pdf|flv|jpg|jpeg|png|gif|swf|ts|webp|mp3|mp4|woff2|css|html|htm|key|m3u8)$">

Header set Access-Control-Allow-Origin "*"

</FilesMatch>

If I am in your shoes I wold not touch on that

DanielnetoDotCom avatar Jan 09 '24 15:01 DanielnetoDotCom

Good morning, I too have the same thing: AJAX error in red banner when sending a file to the encoders. in the media section, I have the encoded file and a fake file. I haven't changed anything on the avideo master site. Capture d’écran 2024-01-09 à 16 11 18

lachainestoplinky avatar Jan 09 '24 15:01 lachainestoplinky

replace:

Header set Access-Control-Allow-Origin "*"

with:

Header always set Access-Control-Allow-Origin "*"

Job done. fixed.

what? does it resolve?

DanielnetoDotCom avatar Jan 09 '24 15:01 DanielnetoDotCom

Dan i have one last bug with the new encoder popup. On the remote servers when i can click save the box stays open but it closes on the local server. Can you help with this please? I dont see any errors whatsoever in my dev tools now for the first time ever. Im using the avideonetwork. Thanks

when you click in save, it supposed to stay open till you click outside the window

DanielnetoDotCom avatar Jan 09 '24 15:01 DanielnetoDotCom

It resolves the ajax error, the ads that never worked, the encoder popup now works, and the the encoders themselves now work again without all those horrible cors errors. For the first time ever my js panel has no errors whatsoever.

para2022 avatar Jan 09 '24 15:01 para2022

Dan i have one last bug with the new encoder popup. On the remote servers when i can click save the box stays open but it closes on the local server. Can you help with this please? I dont see any errors whatsoever in my dev tools now for the first time ever. Im using the avideonetwork. Thanks

when you click in save, it supposed to stay open till you click outside the window

How come it closes on the local encoder then?

para2022 avatar Jan 09 '24 15:01 para2022

Sorry, I may be confused.

check your js logs then

DanielnetoDotCom avatar Jan 09 '24 15:01 DanielnetoDotCom

I tried but they are really clean. I have never seen my js logs this clean since the Allow-Origin changes

para2022 avatar Jan 09 '24 15:01 para2022

but when you click in save, does it really save?

what is the ajax response?

DanielnetoDotCom avatar Jan 09 '24 15:01 DanielnetoDotCom

Well if I try and add a title it wont let me unless its 10 chars long however i can add a short title in the traditional way under the popup. The way we used to change the title and description, so i assume this is a bug. Some titles are shorter than 10 chars. For instance i couldn't add a title called ENC_01 for testing but i can add it the old way before the popup addition.

para2022 avatar Jan 09 '24 15:01 para2022

Hello, my host prohibits touching the Apache configuration. It doesn't matter, what matters is being able to send. and again, afterwards, I delete the video in error

lachainestoplinky avatar Jan 09 '24 15:01 lachainestoplinky

Hello, my host prohibits touching the Apache configuration. It doesn't matter, what matters is being able to send. and again, afterwards, I delete the video in error

You dont need to. Its been worked out and dan has kindly done an update. You can do a git pull now to fix the issue.

para2022 avatar Jan 09 '24 15:01 para2022

I had to change it to Header setifempty Access-Control-Allow-Origin "*"

some other sites fail with Header always set Access-Control-Allow-Origin "*"

DanielnetoDotCom avatar Jan 10 '24 19:01 DanielnetoDotCom

Header setifempty Access-Control-Allow-Origin "*"

I get the errors back again with that so i am using the one below instead:

Header always set Access-Control-Allow-Origin "*"

Everything works fine for me with that. However I do not get the ajax error with your adjustment but i get loads of cors errors and the popup on the encoder gets blocked.

para2022 avatar Jan 11 '24 03:01 para2022

Good morning,I'm at work, it's morning for me 8:54 a.m.so I'm off schedule, 7am with Daniel, he arrives at the end of the day for me.I don't have a pop-up that blocks sending to the encoder, just the red banner marked Error AJAX and an empty video.the title of this video bears the name of the file with the modified encoder, before this change, the video had a title made up of letters and numbers.as soon as I get home, I make a backup of the site and do a git pull.Message ID: @.***>

lachainestoplinky avatar Jan 11 '24 08:01 lachainestoplinky

@para2022 it may be the header set somewhere in your apache

DanielnetoDotCom avatar Jan 11 '24 13:01 DanielnetoDotCom

I have no headers set in apache ive been through all my apache files. I even stopped nginx to see if that was causing some issue. Its weird. I will just have to leave it at Header always set Access-Control-Allow-Origin "*" it works for me.

para2022 avatar Jan 11 '24 13:01 para2022