问题
I am using Angular2, Communicating with a rest API, settings the header like so:
import { Headers } from '@angular/http';
export const contentHeaders = new Headers();
contentHeaders.append('Accept', 'application/json');
contentHeaders.append('Content-Type', 'application/json');
contentHeaders.append('Authorization', localStorage.getItem('id_token'));
Get request like items/
and POST request works, but when making GET requests for one item, like: items/579212a6541d5626732619c3
the server respond with a server error Response for preflight is invalid (redirect)
I thought those get requests are the same, but maybe they are not ? Any solutions ?
回答1:
Redirect + says that you are probably being redirected from that particular request. Are you sure that the ID of item is handled correctly on a backend?
来源:https://stackoverflow.com/questions/38716357/angular2-response-for-preflight-is-invalid-redirect-from-some-get-requests