I am participating in a project that involves a JavaScript SPA that provides a service and is intended to interact via REST APIs with one of our servers. Initially, I proposed to work on the two entities as two separate projects; specifically I put forth the following
- The user accesses the Web app through a
www.myservice.org
address - The Web app contacts an
api.myservice.org
service for REST interactions
but I was immediately faced with rejection. I was told that the Web app, residing at www.myservice.org
, should contact the REST server via something like www.myservice.org/api
because doing otherwise would entail a security threat. I didn't say this was a bad idea, but I insisted on splitting the API server from the SPA-serving one for the following reasons
- Scaling
- Separation of concerns
- Easier code management
I'm much more of a developer than a system admin and security expert, so I couldn't promptly reply their rejection. Why would having two api.myservice.org
and www.myservice.org
servers represent a security issue? I was vaguely told about Cross-site scripting but even then the reasoning wasn't perfectly clear to me.