vue-core-image-upload
vue-core-image-upload copied to clipboard
CORS header issue
When I upload an image I get this error:
The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'http://localhost:8080' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
The rest of my website works perfectly. I can confirm that the images is uploaded however it seams as if there is somtheing going wrong with the response.
My html is this:
<vue-core-image-upload
class="btn btn-primary"
:crop="true"
@imageuploaded="imageuploaded"
:data="company.logo"
:max-file-size="5242880"
crop="local"
:url="getCompanyImageUrl()">
</vue-core-image-upload>
And the reponse is a json message containing a boolean if the image could be saved.
I also met the same problem, how to solve
You could solve this issue via those methods:
- Change your local hosts. (localhost you_api_domain.com )
- Your server side engineer write the header to limit the domain access.
@JackPu 大佬,第一种解决方式,是更改自己的IP地址还是说其他地方?请问有具体解决步骤吗?