Mobile app version of vmapp.org
Login or Join
Deb1703797

: Does servicing an API from a subdomain make your app slower? I have a single-page application (SPA) located in application.com, and I want to serve the API from api.application.com. Since this

@Deb1703797

Posted in: #Api #Subdomain #WebApplications

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme