W
W
WarGot2016-10-17 18:05:46
Angular
WarGot, 2016-10-17 18:05:46

How to send your header in angular?

I send a POST request to the server with a custom Authorization header, and due to the presence of a custom header, it processes an OPTIONS request, which in the response sends information that the request is not valid.
Response Headers:
HTTP/1.1 400 Bad Request
Date: Mon, 17 Oct 2016 15:03:26 GMT
Server: Apache
X-Powered-By: PHP/5.6.20-0+deb8u1
Cache-Control: no-cache
Access-Control -Allow-Methods: POST, PUT, GET, DELETE
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, authorization
Access-Control-Max-Age: 3600
Access-Control- Allow-Origin: *
Content-Length: 33
Connection: close
Content-Type: text/html; charset=UTF-8
Request headers
OPTIONS /passsecurium/api/v2/folder HTTP/1.1
Host: test.server02.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0 FirePHP/0.7.4
Accept : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Access- Control-Request-Method: POST
Access-Control-Request-Headers: authorization
Origin: localhost:4000
x-insight: activate
Connection: keep-alive
Cache-Control: max-age=0
What am I doing wrong? Why is the request not going through?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-10-17
@AMar4enko

It's not about the "custom" header, but about the CORS policy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question