Skip to content

“angular2-image-upload” npm library CORS error #227

@amateosos

Description

@amateosos

I am using angular2-image-upload library to upload certain files

I recently upgraded from 0.6.6 version to 1.0.0-rc.1 (Because I will be needing some of the new features in the future) Howerver it breaks down every time I try to upload an image (when it used to work ok).

Errors:
image

Access to XMLHttpRequest at 'http://192.168.2.103:20005/storage' from origin 'http://192.168.2.103:3007' 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.
zone.js:2969 Cross-Origin Read Blocking (CORB) blocked cross-origin response http://192.168.2.103:20005/storage with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

HTML Code:

<image-upload [preview]="true" [beforeUpload]="onBeforeUpload" [extensions]="getExtension(field.encodingtype)" [url]="localEnvironment.apiURL + '/storage'" [headers]="imageHeaders" [maxFileSize]="getMaxFileSize(field.MaxSize, field)" [buttonCaption]="'Select Files'" [dropBoxMessage]="'Drop your files here!'"(onFileUploadFinish)="fileSentHandler($event, field,imageHeaders)" "></image-upload>

I handle my CORS restrictions and even have the typical plugin for Allow control origin.

As I said this same call works perfectly fine with previous version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions