WWBN / AVideo-Encoder

Encoder Server for AVideo Platform Open-Source
https://platform.avideo.com
GNU Affero General Public License v3.0
152 stars 189 forks source link

trying to install friends encoder getting cors error #435

Open JoshWho opened 2 years ago

JoshWho commented 2 years ago

for some reason it is getting a cors error when it get to the install part.

https://encoder.corder.tv/install/index.php

when entering the info and everything click install it just hangs and inspect element show a cors error with https://corder.tv/login something like that.

Is there something I can add to his main site to say this domain is allowed? and where would that go if so?

error

DanielnetoDotCom commented 2 years ago

It is probably not a clean ubuntu installation and something is blocking access/requests from different domains.

may be some cors rules somewhere on the server installation

JoshWho commented 2 years ago

It is a fresh install kinda I was going off old directions and it started to install another avideo. I deleted the other avideo should I just wipe it and do it again?

DanielnetoDotCom commented 2 years ago

I mean, the streamer site is blocking. it is something on his apache.

maybe a security module

JoshWho commented 2 years ago

On the main website Is there a cors file or is this just something htaccess does? I do not remember doing anything special with mine

JoshWho commented 2 years ago

I wonder if the ssl sets a cors

DanielnetoDotCom commented 2 years ago

by default, avideo leaves all cors rules open.

it is something specific on your web server installation (yes maybe the SSL)

JoshWho commented 2 years ago

Is there a way to run the install without it needing to login to the main site?

DanielnetoDotCom commented 2 years ago

Yes but the problem will still persists

you must resolve the cors problem , otherwise the encoder will be useless

JoshWho commented 2 years ago

only thing I can think is the ssl. Must be something letsencrypt changed.

JoshWho commented 2 years ago

Access to XMLHttpRequest at 'https://corder.tv/login' from origin 'https://encoder.corder.tv' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'https://encoder.corder.tv, *', but only one is allowed.

JoshWho commented 2 years ago

looks like a typo in the cors I think

JoshWho commented 2 years ago

This is the ip http://162.210.100.119/ I do not understand this but will figure it out eventually

DanielnetoDotCom commented 2 years ago

Could you install it using the IP?

JoshWho commented 2 years ago

So even just using the ip it still does the cors thing. Is there a different encoder for just a Standalone Encoder server. The only instructions I found shows how to install this with avideo.

https://www.linuxbabe.com/ubuntu/install-avideo-youphptube-ubuntu-20-04-server

DanielnetoDotCom commented 2 years ago

Remove any cord rule from Apache.conf

also make sure you did install Apache header module

JoshWho commented 2 years ago

Remove any cord rule from Apache.conf

also make sure you did install Apache header module

what u mean by cord rule?

DanielnetoDotCom commented 2 years ago

I mean cors, it was a typo

JoshWho commented 2 years ago

I mean cors, it was a typo

I do not see anything that has cors to it in the confs no header actions not really sure what this is.

JoshWho commented 2 years ago

I think i found it it is the ssl includeSubDomains; was missing will test and write back

JoshWho commented 2 years ago

I think it was the hsts on the domain messing with it. I have new dns settings taking effect fingers crossed will check back later.

JoshWho commented 2 years ago

OK it might not be that at all either. It just won't let me install it no matter what I change

JoshWho commented 2 years ago

Here is the weird part. No matter what I mod in the vhost or in a htaccess it never changes the headers and always shows.

access-control-allow-credentials: true access-control-allow-headers: Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, origin, x-requested-with, content-type access-control-allow-methods: GET,HEAD,OPTIONS,POST,PUT access-control-allow-origin: https://imasdk.googleapis.com, * cache-control: no-store, no-cache, must-revalidate, max-age=1, private, must-revalidate

Any clue why it shows access-control-allow-origin: https://imasdk.googleapis.com, *

because that is what the problem is. I can't find this anywhere to delete.

Restarted apache then rebooted the whole server still no change

JoshWho commented 2 years ago

Is it because there is no videos uploaded yet so there really is no index to the main site that it is just redirecting and not truly doing the cors maybe?

DanielnetoDotCom commented 2 years ago

is very hard for me to guess, that is why I am asking you to remove all access-control rules from the apache.conf and other confs.

usually the AVideo access-control is enough

JoshWho commented 2 years ago

http://162.210.100.119/

https://corder.tv/

https://encoder.corder.tv/install/index.php

Still wondering if this will change if I upload something

I sent credentials in a pm just in case u wanted to give it a peek

JoshWho commented 2 years ago

Any clue what access control could be hiding that I am not seeing. I looked in every conf and even in the htaccess and still do not see anywhere why the Avido script is loading: access-control-allow-origin: https://imasdk.googleapis.com/, * in the header.

It is only the Avideo script reporting that. When I change the doc root directory to a empty folder that access-control-allow-origin: https://imasdk.googleapis.com/, * is no longer there so I know it is something Avideo is doing

DanielnetoDotCom commented 2 years ago

try to install the encoder using another streamer site.

then check if it still works and if you can log in to the original site.

if you are using Cloudflare, disable the Cloudflare proxy.

JoshWho commented 2 years ago

It lets me try my site and your demo test site. When I try a brand new install it shows that access-control-allow-origin: https://imasdk.googleapis.com/, * in the header

JoshWho commented 2 years ago

Go here and you can see the error https://cors-test.codehappy.dev/?url=https%3A%2F%2Fcorder.tv%2F&method=get

This is a fresh Ubuntu 20 and Fresh install of Avideo https://corder.tv/

JoshWho commented 2 years ago

try to install the encoder using another streamer site.

then check if it still works and if you can log in to the original site.

if you are using Cloudflare, disable the Cloudflare proxy.

No cloudflare installed. It is all direct dns with the host. that is what is stumping me about this. Cloudflare I can just force the header to be whatever I want but I do not have that setup on there yet.

DanielnetoDotCom commented 2 years ago

I found this piece of code

https://github.com/WWBN/AVideo/blob/897b69cf12b8d4d5d7eb3d03a067a38f45adc518/objects/functions.php#L3213-L3225

why is your $_SERVER['HTTP_ORIGIN'] empty?

by default, you should send it.

we detect if it is empty and we need this line so we can allow video ads on the website

DanielnetoDotCom commented 2 years ago

I just sent an update to the AVideo, check if makes any difference for you

JoshWho commented 2 years ago

Still doing the same thing. Just git pulled and cleared the cache https://cors-test.codehappy.dev/?url=https%3A%2F%2Fcorder.tv%2F&method=get

JoshWho commented 2 years ago

I found this piece of code

https://github.com/WWBN/AVideo/blob/897b69cf12b8d4d5d7eb3d03a067a38f45adc518/objects/functions.php#L3213-L3225

why is your $_SERVER['HTTP_ORIGIN'] empty?

by default, you should send it.

we detect if it is empty and we need this line so we can allow video ads on the website

Where do I find this to replace what is missing? That looks like the problem just not sure where to fix this at

DanielnetoDotCom commented 2 years ago

I am not sure how to resolve your case.

https://github.com/WWBN/AVideo/blob/51aa129d71d7659d1ef6bbbc2970767e8a7db757/objects/functions.php#L3216

how come your $_SERVER['HTTP_REFERER'] and $_SERVER['HTTP_ORIGIN'] are empty?

what browser are you using?

JoshWho commented 2 years ago

Chrome and can I manually add whatever is missing?

JoshWho commented 2 years ago

I still wonder if this is a just a glitch because there is no videos uploaded yet

DanielnetoDotCom commented 2 years ago

the $_SERVER['HTTP_REFERER'] and $_SERVER['HTTP_ORIGIN'] comes from the server configuration. I am not sure why you are not receiving it.

JoshWho commented 2 years ago

I do not get that error when I change the doc root to a empty folder.

DanielnetoDotCom commented 2 years ago

did you try to install this encoder using your joshwho site as the default site?

JoshWho commented 2 years ago

yes it works with my site

DanielnetoDotCom commented 2 years ago

so clearly the issue is on your friend's server installation.

JoshWho commented 2 years ago

yes but it is only on the avideo script. When I change the doc directory to a folder with a single index file i do not have that error.

That is why I am asking is it possible that maybe because there is no videos there might be script leak somewhere? something is leaving open the tag after the google apis thing

DanielnetoDotCom commented 2 years ago

correct, AVideo requires the $_SERVER['HTTP_REFERER'] or $_SERVER['HTTP_ORIGIN'] , otherwise It cannot work properly

in your case both are blank

JoshWho commented 2 years ago

this encoder https://encoder1.wwbn.net/?justLogin=1&PHPSESSID=xxxxxxxx works with the site https://corder.tv so I do not think that is the issue

Edited: be careful on sharing your PHPSESSID

JoshWho commented 2 years ago

correct, AVideo requires the $_SERVER['HTTP_REFERER'] or $_SERVER['HTTP_ORIGIN'] , otherwise It cannot work properly

in your case both are blank

I can't find anything online about how to correct this on the server. Everything says that is a browser issue.

DanielnetoDotCom commented 2 years ago

is very hard for me to guide you on it too.

did you install only the defaults apache modules?

there is no proxy on it?

JoshWho commented 2 years ago

correct. I just did the step by step tutorial nothing extra listed here https://www.linuxbabe.com/ubuntu/install-avideo-youphptube-ubuntu-20-04-server

DanielnetoDotCom commented 2 years ago

Why don't you try this

https://github.com/WWBN/AVideo/wiki/How-to-install-LAMP,-FFMPEG-and-Git-on-a-fresh-Ubuntu-20.x-for-AVideo-Platform-version-11.x-or-newer

and just delete the AVideo folder when finishes

JoshWho commented 2 years ago

I keep getting alomost done and this i get this error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)