AppEngine实例的许多自定义域 [英] Many Custom Domains for AppEngine Instance
问题描述
对于我们在AppEngine上运行的电子商务服务,我们希望为客户提供在其自定义域名上运行商店的选项(例如:www.mystore.com,而不是www.enstore.com/mystore)。 p>
从用户角度来看,我希望他们在他们的首选项屏幕中输入他们想要使用的域名,并告诉他们如何配置他们的dns。
b$ b
我知道您通常如何将域添加到AppEngine实例(通过Google Apps),但我不确定您是否可以自动执行此操作。即使这是可能的,他们将全部(数百)在我们的谷歌应用程序页面上列出。
任何人都知道这是否可行/是否有很好的方法来做到这一点?
我认为没有办法以编程方式将域添加到AppEngine实例。显然,只能使用您描述的Google Apps方法添加域。这在这个SO帖子中得到了证实:如何让foo.somedomain.com通过myapp.appspot.com/foo在appengine上处理
唯一需要考虑的选项如下: HTTP重定向 许多DNS提供商都支持HTTP重定向。在这种情况下,您的客户可以设置
mystore.com
和 www.mystore.com
重定向到 www.enstore.com/mystore
。这种方法有一些明显的缺点,可能是不可接受的。首先,使用301和302重定向,用户仍然会被转发到已注册的AppEngine网址: www.enstore.com/mystore
,并且它会显示在浏览器中。此外,在301和302重定向之间进行选择可能会使SEO变得棘手,因为您必须了解搜索引擎如何处理这些重定向。例如,当您使用301重定向时,大多数搜索引擎不会将原始网址用作关键字的来源。
除了301和302重定向,一些DNS提供商(如 DNS Made Easy )也提供他们称之为隐藏的隐藏iframe重定向的内容。该页面将在隐藏的iframe内呈现,因此该URL在用户的浏览器中不会更改。然而,这使得搜索引擎优化更加棘手,它不会允许用户为内部页面添加书签,或者很容易引用它们。
正如你所看到的,这个选项小于理想的,但它是在某些情况下考虑的一个选项。另请注意,目前,使用301重定向的HTTP重定向是针对 AppEngine问题跟踪器上的Naked Domain Issue 777。 反向代理 b 另一种选择可能是在其他地方设置小型服务器,如小型 Amazon EC2实例,然后设置一个简单的反向代理。你可以很容易地设置它,只需使用Apache和 mod_proxy < /或>(或其他各种替代方法)。这将允许你要求你的客户建立一个指向这个实例的普通A记录,而Apache HTTP服务器将充当你的AppEngine的代理。 在mod_proxy中设置反向代理的基本配置指令是ProxyPass。对于每个 远程代理的配置可能很容易由你的后端软件来处理。 这是一个更好的解决方案,它可以给你很大的控制权 - 但显然这些好处有一些成本。首先,承载反向代理需要花费。您还将添加另一个失败点,因此您必须将其添加到您的高可用性计划中。此外,如果您通过SSL提供某些网页,它可能会变得非常复杂。 For our e-commerce service running on AppEngine we would like to offer the option for customers to run the stores on their custom domains (eg: www.mystore.com instead of www.enstore.com/mystore). From a user perspective, I'd like them to enter the domain name they want to use in their preference screen and tell them how to configure their dns. I know how you normally add domains to an AppEngine instance (through Google Apps) but I'm not sure you can automate that. And even if that's possible they would be all (hundreds) listed on our google apps page. Anyone know if this is possible/if there is a good way to do it? I don't think there is a way to add domains "programatically" to an AppEngine instance. Apparently, domains can only be added by using the Google Apps method that you described. This is confirmed in this SO post: How do i get foo.somedomain.com get handled by myapp.appspot.com/foo on appengine The only options that pop to mind are the following: HTTP Redirection Many DNS providers support HTTP Redirection. In this case, your clients would be able to set up In addition to 301 and 302 redirects, some DNS providers (like DNS Made Easy) also provide what they call a "masked hidden-iframe redirect". The page will render inside a hidden iframe, so the URL does not change in the user's browsers. However this makes SEO even more tricky, and it will not allow users to bookmark internal pages, or to reference them easily. As you can see, this option is less than ideal, but it is one option to consider in some situations. Also note that at the moment, HTTP Redirection using 301 redirects is the suggested workaround for the Naked Domain Issue 777 on the AppEngine issue tracker. Reverse Proxy Another option could be to set up a small server somewhere else, like a small Amazon EC2 Instance, and set up a simple reverse proxy. You would be able to set this up very easily, just by using Apache and mod_proxy (or various other alternatives). This would allow you to ask your clients to set up a normal A Record pointing to this instance, while the Apache HTTP server would be acting as a proxy to your AppEngine. The fundamental configuration directive to set up a reverse proxy in mod_proxy is the ProxyPass. You would typically set it up with one line like these for each The configuration of the remote proxy could be easily handled by your back-end software. This is a neater solution which gives you plenty of control - but there are obviously some costs for these benefits. First of all, there is the expense to host the reverse proxy. You would also be adding another point of failure, so you have to add this to your high-availability plan. In addition, if you are serving some pages through SSL it can become quite complicated. 这篇关于AppEngine实例的许多自定义域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
VirtualHost
(对于每个客户端域),您通常会为其设置一行:
ProxyPass / http://www.enmystore.com/mystore/
mystore.com
and www.mystore.com
to redirect to www.enstore.com/mystore
. There are some obvious disadvantages with this method that might not be acceptable. First of all, with 301 and 302 redirects, the users will still be forwarded to the registered AppEngine URL: www.enstore.com/mystore
, and it will show in their browser. In addition, choosing between a 301 and 302 redirect can make SEO tricky, since you'd have to get into how search engines behave with these redirects. For example most search engines will not use the original URL as a source for keywords when you use a 301 redirect. VirtualHost
(for each client domain):ProxyPass / http://www.enmystore.com/mystore/