Hi Joshua,
First off,
CORS isn't really a protection against CSRF. For CSRF mitigation ideas take a look
here. CORS is mostly a protection against asset and bandwidth theft. (See
Why CORS?)
Instead of thinking about CORS first, you really want to think about your web application. What assets will it be requesting and where do they live. Your primary assets determine the rules that work for free. (ie. you can always load things from the same spot). (typically your domain or an *.
appspot.com address) . The other spots need to be told that they can permit / give permission for your app to access the data.
As I mentioned earlier, static assets on App Engine are set in your
appengine-web.xml or
app.yaml files. Dynamic assets will need code, for Java Servlet's it's usually easitest to add a
filter that runs before the Servlet. Other frameworks have similar mechanisms.
GoogleAPI's depend on the service your accessing. The most common is Cloud Storage which has a page on
CORS and
configuration. Other Google properties & API's that expect to be accessed via a web application will be configured appropriately or
provide a mechanism.
Hope that helps,
Les