Questions tagged [http-options-method]

The HTTP OPTIONS request method is commonly used to ask a Web server which HTTP methods the server allows; servers typically respond with just a set of headers that includes the Allow header, whose value lists the allowed methods. The OPTIONS method is also a key part of the CORS protocol.

See also:

141 questions
6
votes
3 answers

CORS response headers not working in Spray when requested from browser

I was attempting to implement CORS support on a Spray server (version 1.1-20131011 where cors headers are already supported). Currently, the server code looks like this: trait DefaultCORSDirectives { this: Directives => def defaultCORSHeaders =…
user3590656
  • 61
  • 1
  • 2
6
votes
4 answers

Can Spring autogenerate an 'Allow' header on an OPTIONS method?

When I configure my RequestMappings in Spring MVC, I'd like to automatically generate the proper Allow header when the OPTIONS method is used. For example, with this controller: @Controller @RequestMapping("/test") public class TestController { …
checketts
  • 14,167
  • 10
  • 53
  • 82
6
votes
3 answers

HTTP OPTIONS Pre-flight request Load Cancelled with pending Status in Chrome

I am using Sencha Touch 2.1.0. I am making a HTTP GET call. It is a CORS request. Hence it is sending Pre-flight HTTP OPTIONS command as expected. I have installed CORS filter on my server and configured it. The calls from my code were going…
5
votes
0 answers

Why don't I see preflight (method: OPTIONS) xhr requests in Safari developer tools?

For reasons I don't understand, Safari fails (intermittently but consistently) to connect to our rails app (static front end and api back end) on our QA infrastructure. (I'm going to write another question about that.) For now, one thing that is…
5
votes
2 answers

In HTTP logs I am seeing OPTIONS, GET, OPTIONS, POST why?

I am currently reviewing some proxy logs and seeing: 200 OPTIONS /api/bob/ 200 GET /api/bob/ 200 OPTIONS /api/jim/ 200 PUT /api/jim/ I am wondering a couple of things, why is it doing the OPTIONS call before each request? And, my…
Mr_road
  • 554
  • 6
  • 25
4
votes
4 answers

OPTIONS request for restful cross-domain using CORS

On client side I'm using Ajax.post (jquery 1.5) with json. On server side I'm using rest resteasy-jaxrs-2.0.1.GA. I found somewhere that i should add couple of headers to server response and I've done with following filter: public void doFilter( …
user1039359
  • 41
  • 1
  • 3
4
votes
1 answer

XmlHttpRequest get callback response when request fails

I have a simple request I make to my service: var request = new XMLHttpRequest(); request.open("OPTIONS", url, true); request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); request.setRequestHeader('Accept',…
4
votes
2 answers

Spring MVC does not handle RequestMethod.OPTIONS

I am in the context of a Rest API. As I am performing cross domain request, I need to send back the header "Access-Control-Allow-Origin". I have a controller such: @Controller @RequestMapping("/api") public class PackageManagerRestController { …
Tk421
  • 6,196
  • 6
  • 38
  • 47
3
votes
0 answers

How to comunicate available filter options to the frontend using Django REST framework / django filter?

We are running DRF in combination with django filter to narrow down list view results. As filters and filter options are increasing, we would like the frontend to display only the available (the select-able) filter choices. Simple example: There…
3
votes
1 answer

Should OPTIONS requests to rest api be allowed if unauthenticated?

I enabled Spring Security on a Rest API and saw that OPTIONS requests are being rejected because they miss the Authorization header. Should I require (is it possible?) that clients include that header even in OPTIONS (pre-flight) requests, or should…
watery
  • 5,026
  • 9
  • 52
  • 92
3
votes
1 answer

Proxy server is not handling OPTIONS request correctly

I have this simple node.js proxy server implementation: const s = http.createServer((req, res) => { console.log('req method:', req.method); if(String(req.method || '').toUpperCase() === 'OPTIONS'){ …
user12861522
3
votes
2 answers

OPTIONS Http request is failing with 404 exception while Post request is working fine

I've a rest endpoint with an optional PathVariable in spring framework. @PostMapping("/API_PATH/{param1}/{param2}") public Result getResult(@PathVariable Integer param1, @PathVariable(required = false) Integer param2, @RequestBody Data data) { …
pkgajulapalli
  • 1,066
  • 3
  • 20
  • 44
3
votes
2 answers

How do i disable options request method from being even processed in dropwizard

I send a curl command with OPTIONS request method to my dropwizard application. I get a 200 Ok and POST and OPTIONS methods allowed as response. How do i stop this from happening for security reasons as this provides some info about what are…
3
votes
1 answer

Should an OPTIONS request ever return 429?

Should an OPTIONS request ever return a 429? The problem is really that a Browser client (js) can not detect the 429 correctly when returned from an OPTIONS request. So I'm leaning towards only returning 429 for non OPTIONS requests. What is best…
vincent
  • 1,953
  • 3
  • 18
  • 24
3
votes
2 answers

How to avoid preflight OPTIONS request with node request package for CORS?

I simply wish to post some json but by default request does a preflight OPTIONS request. I would like to avoid this as users often have unreliable connections, an extra request further reduces reliability and results in cryptic error messages like…
Fabian Barkhau
  • 1,349
  • 2
  • 12
  • 31
1 2
3
9 10