3

I have a single-page application (SPA) located in application.com, and I want to serve the API from api.application.com.

Since this is a Cross-Origin Resource Sharing (CORS) browser application, it will always make OPTIONS requests prior to the actual one. Would this make my SPA twice as slow?

1
  • 2
    Benchmark it and see. (And find out the answer is no. That little bit of extra work shouldn't have that kind of effect on your load times). – John Conde Jul 11 '14 at 18:42
2

Since your OPTIONS response doesn't actually rely on the same application logic your application does I wouldn't expect it to be twice as slow. If your OPTIONS response does not include an entity-body (only a header response, similar to HEAD) then the data transfer will be quite small and much quicker. But you will still have the latency between your visitor/user and your application server.

Also, I would go with a DNS A record for your sub domain, if not already. If you use a CNAME record it will require an additional DNS lookup to get the IP address for what the CNAME entry is pointed at.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.