Independent game developers - making Avoyd

Domain masking using Google App Engine

Juliette Foucaut - 20 Jun 2014


In this post I'll describe how to use Google App Engine to masked redirect a URL to a desired domain. Our proposed method of URL redirection involves a python script using the webapp2 framework running server-side on GAE. As a result of this setup, you can have visitors requesting content from one domain, say www.new-url.com, see content which is hosted on another such as www.old-url.com.

The way it works is as follows: GAE is configured to use www.new-url.com as a custom domain. Whenever a visitor requests a page from www.new-url.com, GAE fetches the data from www.old-url.com, then forwards it. To the visitor, the page effectively comes from www.new-url.com. This is particularly useful if you have content hosted in a service which doesn't allow you to set up the custom domain you want.

Advantages

  1. it's completely invisible. Visitors can't tell they have been redirected by looking at the page source. In contrast, a javascript redirect would make the web address visible to anyone -including search engines- who viewed the source.

  2. visitors with disabled javascript can be redirected -for example web search engines and people who use a no-script plugin-

  3. it's a workaround for the fact that Google Sites does not allow masked redirect using a frame.

  4. free if you already use Google Apps for Business.
    If you'd like to support us, you can use our referral link to try Google Apps for business.

Downsides

  1. whilst Google App Engine is free to use within limited parameters, to set up a custom domain, you need Google Apps for Business.

  2. increased server overhead - both the content hosting site and GAE have to serve the content. This can be resolved with caching (not covered in this post).

  3. as with any masked redirection, the original website still exists and is publicly available - however in some cases you might be able to setup permissions on the content server such that only the GAE app can access the content.

  4. if the original website contains absolute links, code should be added to the python script to parse the html on the fly and update those links to refer to the new domain.

Method

  1. Create a Google App Engine application with two files: app.yaml and redirect.py.

  2. Paste the code below in app.yaml:

    application: masked-redirect
    version: 1
    runtime: python27
    api_version: 1
    threadsafe: yes
    
    handlers:
    - url: /.*
      script: redirect.application
      
    libraries:
    - name: webapp2
      version: "2.5.2"
    

  3. Paste the code below in redirect.py, replacing www.old-url.com with your value:

    import webapp2
    from google.appengine.api import urlfetch
    
    class MainPage(webapp2.RequestHandler):
        def get(self):
    		url = "http://www.old-url.com" + self.request.path_qs
    		result = urlfetch.fetch(url)
    		self.response.out.write(result.content)
    
    application = webapp2.WSGIApplication([(r'.*', MainPage),], debug=True)
    
    def main():
    	application.run()
    

  4. Upload the files to Google App Engine and ensure the application is running.

  5. Follow the GAE instructions to set up the custom domain www.new-url.com.


comments powered by Disqus
 › 2017
 › Avoyd Editor Prototype
 › 2016
 › Black triangles and Peter Highspot
 › Colour palettes and lighting
 › Concept art by Rebecca Michalak
 › 2015
 › Internals of a lightweight task scheduler
 › Implementing a lightweight task scheduler
 › Feral Vector
 › Normal generation in the pixel shader
 › 2014
 › Python Google App Engine debugging with PyCharm CE
 › Lighting voxel octrees and procedural texturing
 › Patterns and spheres
 › Python Google App Engine debugging with PyTools
 › Interview
 ›› Domain masking using Google App Engine 
 › Octree streaming - part 4
 › Black triangles and nervous_testpilot
 › Presskit for Google App Engine
 › Octree streaming - part 3
 › Octree streaming - part 2
 › Octree streaming
 › 2013
 › LAN discovery with multiple adapters
 › Playing with material worlds
 › Developer Diary archive
 › Website redesign
 › First Person Editor
 › First Avoyd tech update video
 › Implementing a static website in Google App Engine
 › Multiplayer editing
 › First screenshots
 › Thoughts on gameplay modes
 › Back in 1999
 › 2002
 › ECTS 2002
 › Avoyd Version 1.6.1 out
 › Avoyd Version 1.6 out
 › 2001
 › Biting the bullet
 › Avoyd version 1.5 out
 › Monday Mayhem
 › Avoyd version 1.5 alpha 1 out
 › Avoyd version 1.4 out
 › ECTS 2001
 › Fun with Greek letters
 › Closer just a little closer
 › Back already
 › Artificial Humanity
 › Products and promises
 › Ecommerce
 › Explosions galore
 › Spring fixes
 › Open source and ports to other operating systems
 › Avoyd LAN Demo Version 1.1 is out
 › Thanks for the support
 › Avoyd LAN Demo Ready
 › Game Tech
 › Internals of a lightweight task scheduler
 › Implementing a lightweight task scheduler
 › Normal generation in the pixel shader
 › Lighting voxel octrees and procedural texturing
 › Octree streaming - part 4
 › Octree streaming - part 3
 › Octree streaming - part 2
 › Octree streaming
 › LAN discovery with multiple adapters
 › enkiTS
 › Internals of a lightweight task scheduler
 › Implementing a lightweight task scheduler
 › Web Tech
 › Python Google App Engine debugging with PyCharm CE
 › Python Google App Engine debugging with PyTools
 ›› Domain masking using Google App Engine 
 › Presskit for Google App Engine
 › Implementing a static website in Google App Engine
 › Avoyd
 › Avoyd Editor Prototype
 › Black triangles and Peter Highspot
 › Colour palettes and lighting
 › Concept art by Rebecca Michalak
 › Feral Vector
 › Patterns and spheres
 › Interview
 › Black triangles and nervous_testpilot
 › Playing with material worlds
 › Website redesign
 › First Person Editor
 › First Avoyd tech update video
 › Multiplayer editing
 › First screenshots
 › Thoughts on gameplay modes
 › Back in 1999
 › Avoyd 1999
 › Developer Diary archive
 › Back in 1999
 › ECTS 2002
 › Avoyd Version 1.6.1 out
 › Avoyd Version 1.6 out
 › Biting the bullet
 › Avoyd version 1.5 out
 › Monday Mayhem
 › Avoyd version 1.5 alpha 1 out
 › Avoyd version 1.4 out
 › ECTS 2001
 › Fun with Greek letters
 › Closer just a little closer
 › Back already
 › Artificial Humanity
 › Products and promises
 › Ecommerce
 › Explosions galore
 › Spring fixes
 › Open source and ports to other operating systems
 › Avoyd LAN Demo Version 1.1 is out
 › Thanks for the support
 › Avoyd LAN Demo Ready