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.

Why `POST` and `DELETE` request call `OPTIONS`?

See original GitHub issue

I’m trying to do DELETE or POST request to some singleton rest object, and the result is that it actually calling OPTIONS instead(which failed, because I have no such a method in my API)…

$scope.$$event=API.one('events', id);
$scope.$$rsvp = $scope.$$event.one("rsvp");

//trying to request REMOVE action to /events/:id/rsvp
$scope.$$rsvp.remove();

How can I pass it?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
svyckacommented, Oct 18, 2013

That depends on you backend for example with apache server you can do something like this in .htaccess file:

<ifModule mod_headers.c>
    Header always set Access-Control-Allow-Origin: "*"
    Header always set Access-Control-Allow-Methods "POST, GET, PUT, DELETE, OPTIONS"
    Header always set Access-Control-Allow-Headers "origin, x-requested-with, content-type"
</ifModule>

add more headers if you use something more then thease and everything should work.

0reactions
pratikpawarnasikcommented, May 21, 2018

I got this issue. i am using codeigniter in backend api but still not fixed. Tell me proper solution for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my browser sending an OPTIONS HTTP request ...
As you can see, the POST method is never sent and only a method called OPTIONS is sent to the endpoint. The response...
Read more >
Difference between PUT and DELETE request in Vanilla ...
PUT Request, DELETE Request ; It is used to Create or Modify a resource. It is used to delete a resource identified by...
Read more >
Why is an OPTIONS request sent and can I disable it?
Options request is a preflight request when you send (post) any data to another domain. It's a browser security issue. But we can...
Read more >
HTTP request methods - MDN Web Docs
Chrome Edge CONNECT Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history DELETE Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history GET Full...
Read more >
HTTP/1.1: Method Definitions
These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a...
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