Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

each service call is generating a separate http OPTIONS and POST round-trip #385

Closed
devoncarew opened this issue Apr 30, 2015 · 0 comments
Closed

Comments

@devoncarew
Copy link
Member

We're sending two requests for each rpc call. The first one is always an OPTIONS call, and the next is the POST call with the data. The browser sends the OPTIONS one, waits for the response, and then sends the POST one. So we're doing two full round trips for each call. The OPTIONS request is handled quickly on the server, but we're paying the cost for the roundtrip time twice.

From reading this (https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS):

Unlike simple requests (discussed above), "preflighted" requests first send an HTTP request by the OPTIONS method to the resource on the other domain, in order to determine whether the actual request is safe to send. Cross-site requests are preflighted like this since they may have implications to user data. In particular, a request is preflighted if:
It uses methods other than GET, HEAD or POST. Also, if POST is used to send request data with a Content-Type other than application/x-www-form-urlencoded, multipart/form-data, or text/plain, e.g. if the POSTrequest sends an XML payload to the server using application/xml or text/xml, then the request is preflighted.
It sets custom headers in the request (e.g. the request uses a header such as X-PINGOTHER)

I see that our POST requests are encoded using 'application/json' and not one of the whitelisted encodings listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant