在Google App Engine上禁用Node JS的默认域https:// [project-id] .appspot.com [英] Disable default domain https://[project-id].appspot.com of Node JS on Google App Engine

查看:111
本文介绍了在Google App Engine上禁用Node JS的默认域https:// [project-id] .appspot.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将我的Node JS应用程序部署到Google Cloud App Engine,并且可以成功地为我的应用程序添加我的自定义域。



假设我的自定义域名 example.com



现在我可以通过example.com& www.example.com ,它按预期工作。但我发现我仍然可以通过默认域浏览我的应用程序。
https:// [project-id] .appspot.com



我想禁用默认域,是否可以这样做? p>您无法禁用该默认域。你将不得不编写一个重定向脚本。您可以在请求的 HTTP_HOST 中测试appspot,并在请求的 HTTP_USER_AGENT 中测试AppEngine-Google ,以确定它是否是内部请求。



此外,内部函数(如cron作业和任务队列)在该域上运行,因此请小心操作。任务队列将失败301。


I have deployed my Node JS app onto Google Cloud App Engine, and I can successfully add my custom domain for my app.

Let say my custom domain is example.com.

Now I can browse my app via example.com & www.example.com, it works as expected. But I find that I can still browse my app through the default domain. https://[project-id].appspot.com

I want to disable the default domain, is it possible to do that?

解决方案

You cannot disable that default domain. You would have to write a redirect script. You can test for "appspot" in the request's HTTP_HOST, and test for "AppEngine-Google" in the request's HTTP_USER_AGENT, to determine if it is an internal request.

Also, internal functions, like cron jobs and task queues, run on that domain, so be careful what you do. Task queues will fail given a 301.

这篇关于在Google App Engine上禁用Node JS的默认域https:// [project-id] .appspot.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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