7

First, Build a site www.example.com with Google App Engine https://cloud.google.com/products/

Second, Upload a static image example.jpg to Google Cloud Storage https://cloud.google.com/products/cloud-storage aka https://developers.google.com/storage/

Is it possibe to serve the example.jpg as http://www.example.com/images/example.jpg? instead of using a subdomain such as images.example.com or cdn.example.com etc

The reason I want to do this is because I want to make it easier to move my site to a VPS when necessary.

Gaby Solis
  • 2,037
  • 5
  • 18
  • 25

2 Answers2

2

I don't believe so, no. A single domain name must route to either Google Cloud Storage or Google App Engine.

You could cheat, mind you. You could configure your app engine app to take all requests for, say "/images/X" and redirect them to images.example.com/X, or you could have your app read the data from GCS and feed it back to the user directly from app engine, but neither of those are a good solution.

If you wanted to move to a VPS later, you could perhaps configure the VPS to handle two domains, one for images and one for dynamic content.

Brandon Yarbrough
  • 33,119
  • 22
  • 98
  • 134
  • I agree with the last sentence. Subdomains shouldn't be a blocker for moving to a VPS in the future. You can forward both subdomains to the same IP address and configure your web server to handle both. – Brian Dorsey Jul 09 '13 at 16:19
  • Why is your second suggestion not a good solution: "...have your app read the data from GCS and feed it back to the user directly from app engine"? Performance or cost considerations? I have been considering exactly this for my app. – Jeremiah Aug 08 '13 at 00:38
  • Mostly performance. Bandwidth from GCS to App Engine is free, and I think the outgoing bandwidth for app engine is the same price as GCS, so I don't think it would cost much more. I imagine the only additional expense is extra app engine instances handling the transfers. I haven't measured the performance implications, but it's an extra hop through a service, so I wouldn't be surprised if it cost you some small extra latency. Serving static content through a static content service is just gonna be fastest. That said, if you need to do it, try it out, and if it's fast enough for you, great! – Brandon Yarbrough Aug 08 '13 at 05:19
0

You have setup Google Cloud Storage (GCS) https://cloud.google.com/products/cloud-storage aka https://developers.google.com/storage/

You could not serve your image example.jpg that uploaded to Google Cloud Storage (GCS) as http://www.example.com/images/example.jpg when you have assigned your www.example.com pointed other than GCS (c.storage.googleapis.com).

If you insist to serve with the domain, you may consider to parsing the images in base64code when you could redirecthttp://www.example.com/images/example.jpg via .htaccess to a dynamic file where you can put the code to print out the image on the fly like so:

header("Location: http://mybucket/resample/example.jpg");

You may also consider to put your static files like js, html, css, etc in the bucket and access those files to act like a dynamic content via Google App Engine (GAE).

Community
  • 1
  • 1
Chetabahana
  • 7,806
  • 2
  • 50
  • 70