hapi.js Cors Pre-flight-nicht Rückkehr-Access-Control-Allow-Origin-header

Habe ich ein ajax Datei-upload mit (Dropzone js). sendet eine Datei an meinen server hapi. Ich merkte, sendet der browser eine PREFLIGHT-OPTIONEN-METHODE. aber mein hapi-server scheint nicht zu senden Sie die richtige Antwort-Headern, so bin ich immer Fehler in chrome.
hier ist der Fehler, bekomme ich auf chrome

XMLHttpRequest cannot load http://localhost:3000/uploadbookimg. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

dies ist die hapi js route-handler

server.route({
        path: '/uploadbookimg',
        method: 'POST',
        config: {
            cors : true,
            payload: {
                output: 'stream',
                parse: true,
                allow: 'multipart/form-data'
            },
        handler: require('./books/webbookimgupload'),
        }
    });

In meinem Verständnis hapi js sollte senden alle cors-Header aus der Pre-Kampf (OPTIONEN) verlangen.
Cant verstehen, warum Ihr nicht

Netzwerk-Anfrage - /Antwort-aus Chrom -

**General**
Request Method:OPTIONS
Status Code:200 OK
Remote Address:127.0.0.1:3000

**Response Headers**
view parsed
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
cache-control: no-cache
vary: accept-encoding
Date: Wed, 27 Apr 2016 07:25:33 GMT
Connection: keep-alive
Transfer-Encoding: chunked

**Request Headers**
view parsed
OPTIONS /uploadbookimg HTTP/1.1
Host: localhost:3000
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Access-Control-Request-Method: POST
Origin: http://localhost:4200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36
Access-Control-Request-Headers: accept, cache-control, content-type
Accept: */*
Referer: http://localhost:4200/books/upload
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8

Vielen Dank im Voraus

InformationsquelleAutor kweku360 | 2016-04-27
Schreibe einen Kommentar