question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add custom header cause request method change from GET to OPTIONS

See original GitHub issue

Hi,

I’m dealing with this trouble.

With this call everything works

SkinSvc.one(skinId).customGET('events', params).then(success, error);

With this one with custom header a OPTIONS Http request is send to my API instead of GET request.

SkinSvc.one(skinId).customGET('events', params, {'Cache-Control':'no-cache'}).then(success, error);

get

options

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
enryoldcommented, Mar 21, 2016

Thank you, i solved adding this headers to option request

'Access-Control-Allow-Headers', 'Cache-Control'
'Access-Control-Allow-Methods', 'GET'
1reaction
daviesgeekcommented, Mar 21, 2016

The OPTIONS request is a part of CORS (Cross Origin Resource Scripting). Your server should be checking the request and returning the correct headers for a given request (Access-Control-Allow-Credentials, Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin, etc…) More detailed info can be found on the MDN page for CORS

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you send a custom header in a CORS preflight ...
I can see jQuery making the OPTIONS request, but it doesn't send the custom header along. Methods I've tried: Using the beforeSend option:...
Read more >
Access-Control-Allow-Headers - HTTP - MDN Web Docs
It indicates that a custom header named X-Custom-Header is supported by CORS ... OPTIONS /resource/foo Access-Control-Request-Method: GET ...
Read more >
request - Cypress Documentation
Cypress sets the Accepts request header and serializes the response body by the encoding option. method (String). Make a request using a specific...
Read more >
HTTP header manipulation - Envoy Proxy
Envoy will always set the :scheme header while processing a request. ... request of the form GET /docs/thing HTTP/1.1 would have a :method...
Read more >
Troubleshoot CORS errors from API Gateway - AWS
You can't use the x-apigw-api-id custom header, because it initiates a preflight OPTIONS request that doesn't include the header. API calls that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found