在Google App Engine上以编程方式设置子域 [英] Programmatically setting subdomain on Google app engine

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

问题描述

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

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.

我想从电子邮件ID中捕获公司,并将URL设置为company.mysite.com,它将映射到www.mysite.com.我认为可以通过在域名注册商cpanel上使用*通配符CNAME来完成.但是,根据线程如何设置动态子域跨服务器或DNS设置,我们无法使用GAE设置通配符域.

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.

所以,我的问题是我应该如何从电子邮件ID中以编程方式进行操作,从而不必为每个公司手动设置子域?我可以在GAE上使用通配符子域,还是需要对AWS的route53进行一些研究?

So, my question is how should I do it programmatically 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?

请注意,我已经从Godaddy注册了我的域名.

Note that I have registered my domain from godaddy.

推荐答案

说明

  1. 注册AWS Route53
  2. 在您的新Route53帐户中,创建一个新的托管区域,该值是您在GoDaddy上托管的域(在您的示例中,区域名称为mysite.com)
  3. 现在按照步骤这里在为我们注册的域名设置名称服务器"下>>我的域名具有特定的名称服务器"(您将放入步骤2中提供的名称服务器)
  4. 现在,该域必须是Google Apps域,因此,如果不是,请注册Google Apps或将该域添加到您现有的Google Apps帐户中.
  5. 完成自定义域设置过程,但在中输入*作为您的子域步骤5
  6. 返回到Route53控制台,并将新记录集添加到您在步骤2中创建的托管区域中.将类型"切换为CNAME,输入*作为名称,并将值设置为(或在第5步的设置过程中提供给您的任何信息)
  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)

仅此而已.您必须稍等片刻,DNS设置才能正确传播,但是现在wildcard.mysite.com应该指向您的应用程序.

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.

注意

这将允许任何通配符指向您的应用.请参阅上方链接的自定义域设置过程"页面中的有关通配符子域映射的更多信息下的注释.您可以通过处理应用中的值并为您不想确认的子域返回404错误等(在您的用例中,任何不是公司名称的值)来限制应用中允许"的子域.已注册您的应用程序的用户)

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 App Engine上以编程方式设置子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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