Origin https://[xxxxxx].test is not allowed by Access-Control-Allow-Origin. Status code: 200
Hello, I want to retrieve an image from an other Laravel website (project) for my FileUpload.
But I have problems with CORS (where this error comes from).
I have searched what the problem is but I can't find the solution.
has someone experience that can help me or show me an better method?
9 Replies
ensure your .env has APP_URL set correctly
it is (if it is right). but I changed the driver url in the filesystem config to an (temporary) hardcoded one.
You shouldn't be changing the domain of downloading/viewing files. If you do, you need to allow them in the CORS requests.
that mite be the problem that I am having, because the
https://live.webinary.test
and the https://admin.webinary.test
are not the same Laravel project.
Also I use an Api to send images to https://live.webinary.test
. And I want that the FileUpload from https://admin.webinary.test
show the images that was send to https://live.webinary.test
.
some clarification: the filament form from the https://admin.webinary.test
domain must be able to download/view files form the https://live.webinary.test
domain. and that is where the problem starts. and where I can't find a solution.He's trying to load the image from a different Laravel page
CORS is there to prevent loading content from another page without it allowing it. On that other page you need to allow that page you are loading it from. You can adjust CORS settings for Laravel inside
config/cors.php
I think.I have seen solutions that added urls to the
allowed_origins
(at least it seemed so). so I added https://admin.webinary.test
to the allowed_origins
array of live.webinary
cors config, but it didn't work.
also in the standard allowed_origins
it has an *
which means all (right?). so it is strange that it didn't work in the beginning.Your image folder is probably not served via Laravel so you need to set those header via your server config.
I don't really know what you mean, sadly.
I have googled for 'server config' and 'set header image folder in server config', but i can't find the solution to my problem.
That you probably need to configure your server (Apache/nginx/whatever) instead of Laravel to send that header.