以编程方式在Google应用引擎上设置子域名 [英] Programatically setting subdomain on Google app engine

查看:136
本文介绍了以编程方式在Google应用引擎上设置子域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的应用程序部署到主域www.mysite.com的GAE上。当有人订阅我的应用程序时,他将使用电子邮件ID username@company.com。



我想从电子邮件ID捕获公司,并将url设置为公司.mysite.com将映射到www.mysite.com。我认为这可以通过在域名注册商cpanel上使用*通配符CNAME来完成。但是,按照线程如何设置动态子域跨服务器或在DNS设置我们不能设置与GAE的通配域。



所以,我的问题是我应该如何编程从电子邮件ID这样做我不必为每家公司手动设置子域名?我可以在GAE上使用通配符子域吗?或者我需要对AWS的route53进行一些研究?



让我知道是否缺少任何信息。任何帮助将不胜感激。



更新:
对于您的信息,我已经从godaddy注册了我的域名。

/ li>
  • 在新的Route53帐户中,创建一个新的托管区域,该值为您在GoDaddy上托管的域(在您的示例中,区域名称为 mysite。 com

  • 现在按照这里在为我们注册的域名设置名称服务器下>>我为我的域名设置了特定的域名服务器请在第2步中提供给您的名称服务器中)

  • 现在,此域名必须是Google Apps域名,因此如果不是,请注册Google Apps或将域名添加到您现有的Google Apps帐户。

  • 浏览自定义域名设置流程,但在步骤5中输入 * 作为您的子域名

  • 返回到Route53控制台,并将新记录集添加到您在步骤2中创建的Hosted Zone。将类型切换为 CNAME ,输入 * 作为名称,并且该值应该设置为 ghs.googlehosted.com (或者通过步骤5中的设置过程)

    就是这样。您必须稍等一点才能正确传播DNS设置,但现在 wildcard.mysite.com 应该指向您的应用。

    注意

    这将允许任何通配符指向您的应用。请参阅上面链接的自定义域设置流程页面中更多关于通配符子域映射的说明。您可以通过处理应用中的值并为您不想承认的子域返回404错误或类似内容来限制应用中的允许子域(在您的用例中,任何非公司名称的值已注册申请的用户)

    I am having my application deployed to GAE with main domain www.mysite.com. When someone subscribe to my application, he will use email id username@company.com.

    I want to capture the company from the email id, and set the url as company.mysite.com that will map to www.mysite.com. I think this can be done by using * wildcard CNAME on domain registrar cpanel. But, as per thread How to set dynamic subdomain cross server or in DNS setting we can't set wildcard domain with GAE.

    So, my question is how should I do it programatically from email id so I don't have to manually set sub-domain for each company ? Can I use wildcard sub-domain on GAE or I need to do some research on route53 of AWS ?

    Let me know if I am missing any info. Any help will be appreciated.

    UPDATE: For your info, I have registered my domain from godaddy.

    解决方案

    Instructions

    1. Sign up for AWS Route53
    2. In your new Route53 account, create a new Hosted Zone, the value being the domain you are hosting on GoDaddy (in your example, the zone name would be mysite.com)
    3. Now follow the steps here Under "Setting Nameservers for a Domain Name Registered with Us" >> "I have specific nameservers for my domains" (you'll put in the name server provided to you in step 2)
    4. Now, this domain needs to be a Google Apps domain, so if its not, sign up for Google Apps or add the domain to your existing Google Apps account.
    5. Go through the Custom Domain Setup Process but enter * as your subdomain in step 5
    6. Go back to your Route53 Console and Add a new record set to the Hosted Zone you made in step 2. Switch the Type to CNAME, enter * as the name, and the value should be set to ghs.googlehosted.com (or whatever is provided to you through the setup process in step 5)

    That's just about it. You'll have to wait a bit for the DNS settings to properly propagate, but now wildcard.mysite.com should point to your app.

    NOTE

    This will allow ANY wildcard to point towards your app. See the notes under More About Wildcard Subdomain Mapping in the Custom Domain Setup Process page linked above. You can limit what subdomains are "allowed" in your app by processing the value in your app and returning 404 errors or the like for subdomains you do not want to acknowledge (in your use case, any value that is not a company name of a user who has signed up for your application)

    这篇关于以编程方式在Google应用引擎上设置子域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆