Different static files for the same path but different domains on App Engine

Petr Shevtsov

I'm running WordPress Network with custom domains on Google App Engine Standard Environment (so I can't use nginx or something).

What I want to do is to serve different static content for different domains but using the same path:

somedomain1.com/favicon.ico ----> static/somedomain1.com/favicon.ico
somedomain2.com/favicon.ico ----> static/somedomain2.com/favicon.ico
somedomain3.com/favicon.ico ----> static/somedomain3.com/favicon.ico

etc…

I tried to use domain names in app.yaml URL handlers, but it ain't work for me:

handlers:
- url: (http|https)://somedomain1.com/favicon.ico
  static_files: static/somedomain1.com/favicon.ico
  upload: static/somedomain1.com/favicon.ico

Is this possible by means of the standard environment of App Engine?

Dan Cornilescu

You cannot use the app.yaml URL routing for such purpose because the handler url configuration doesn't apply to the host/domain name portion of the URL, it only applies to the file path portion. From the url row in the Handlers element table (emphasis mine):

url

Required element under handlers. The URL pattern, as a regular expression. The expression can contain groupings that can be referred to in the file path to the script with regular expression back-references. For example, /profile/(.*)/(.*) would match the URL /profile/edit/manager and use edit and manager as the first and second groupings.

In other words this portion of your configuration is not really valid:

url: (http|https)://somedomain1.com/favicon.ico` 

You could complement your WordPress static offering with a small app which could take care of dynamically selecting a particular artifact based on the domain in the request's URL.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Point 2 domains on the same hosting to different files

From Dev

Can a Rails app and engine on different base domains share session?

From Dev

Can a Rails app and engine on different base domains share session?

From Dev

App Engine: different results for same objectify query

From Dev

App Engine: different results for same objectify query

From Dev

Setting up custom domains (with subdomains) on Google App Engine with SSL with different versions of app

From Dev

Different static files in different templates

From Dev

Redirect different domains pointing to same server to different version of same website

From Dev

Redirect different domains pointing to same server to different version of same website

From Dev

Tracking same domains but different environments in Google Analytics

From Dev

php copy() on same server different domains

From Dev

Multiple Domains, different language, same url for a page

From Dev

Include PHP file on same server, different domains

From Dev

putting the files in different folders with google app engine... python

From Dev

Is it ok to define static inline function with same name in different files?

From Dev

How to set up two domains to point at the same app with Passenger but with different Rails functionality?

From Dev

2 folders added to PATH contain different files with the same name

From Dev

serving static files in different locations

From Dev

How to have 2 different web/app servers for the same domain but different context path?

From Dev

How to have 2 different web/app servers for the same domain but different context path?

From Dev

App Engine can't find static files

From Dev

Where are the static files located in google app engine?

From Dev

Where are the static files located in google app engine?

From Dev

Files.exists(path) and path.toFile().exists() give different results for the same file

From Dev

Rails Path Helper - same path for different namespaces

From Dev

Can a app have different files for different devices?

From Dev

Is it possible to list sitemaps for different domains in the same robots.txt file?

From Dev

Deleting Cookies with same name across different domains using jQuery

From Dev

PHP create cookies on different domains on same server (cURL)

Related Related

  1. 1

    Point 2 domains on the same hosting to different files

  2. 2

    Can a Rails app and engine on different base domains share session?

  3. 3

    Can a Rails app and engine on different base domains share session?

  4. 4

    App Engine: different results for same objectify query

  5. 5

    App Engine: different results for same objectify query

  6. 6

    Setting up custom domains (with subdomains) on Google App Engine with SSL with different versions of app

  7. 7

    Different static files in different templates

  8. 8

    Redirect different domains pointing to same server to different version of same website

  9. 9

    Redirect different domains pointing to same server to different version of same website

  10. 10

    Tracking same domains but different environments in Google Analytics

  11. 11

    php copy() on same server different domains

  12. 12

    Multiple Domains, different language, same url for a page

  13. 13

    Include PHP file on same server, different domains

  14. 14

    putting the files in different folders with google app engine... python

  15. 15

    Is it ok to define static inline function with same name in different files?

  16. 16

    How to set up two domains to point at the same app with Passenger but with different Rails functionality?

  17. 17

    2 folders added to PATH contain different files with the same name

  18. 18

    serving static files in different locations

  19. 19

    How to have 2 different web/app servers for the same domain but different context path?

  20. 20

    How to have 2 different web/app servers for the same domain but different context path?

  21. 21

    App Engine can't find static files

  22. 22

    Where are the static files located in google app engine?

  23. 23

    Where are the static files located in google app engine?

  24. 24

    Files.exists(path) and path.toFile().exists() give different results for the same file

  25. 25

    Rails Path Helper - same path for different namespaces

  26. 26

    Can a app have different files for different devices?

  27. 27

    Is it possible to list sitemaps for different domains in the same robots.txt file?

  28. 28

    Deleting Cookies with same name across different domains using jQuery

  29. 29

    PHP create cookies on different domains on same server (cURL)

HotTag

Archive