【问题标题】:Google App Engine - 404 Error when using Custom Domain from Google DomainsGoogle App Engine - 使用 Google Domains 中的自定义域时出现 404 错误
【发布时间】:2021-02-27 06:24:08
【问题描述】:

我在 GAE 提供的“myproject.appspot.com”格式的 URL 上运行了一个框架 Google App Engine。我有两个服务——一个运行后端 Node/Express 服务器,另一个运行 React 前端。后端服务有 url“api-dot-myproject.appspot.com”和前端“client-dot-myproject.appspot.com”。我已经独立部署了每个服务以及根级别的 dispatch.yaml,并让这些 GAE 提供的 url 工作。当我访问 Google 提供的 URL 时,我部署的服务按预期工作。但是,我也尝试过使用 Google Domains 的自定义域,这给我带来了麻烦。我已按照 Google 提供的说明进行操作 - 我首先从 Google 购买了域名,然后将其添加到 Google App Engine。然后,我的 GAE 应用为我提供了 A、AAAA 和 CNAME 记录,以添加到我的 Google Domains“自定义资源记录”中。

然后,我等待了 24 多个小时才尝试访问 mydomain.app(我购买的域名)。但是,尝试访问该页面会导致 404 错误。

我一直在尝试解决这个问题,并且我已经搜索了有关此主题的所有以前的 stackoverflow 问题,但无法解决它。任何帮助将不胜感激。

dispatch.yaml:

dispatch:
  - url: "*client-dot-myproject.appspot.com/*"
    service: client
  - url: "*mydomain.app/*"
    service: client
  - url: "*api-dot-myproject.appspot.com/*"
    service: api
  - url: "*/*"
    service: client

api.yaml

runtime: nodejs12
service: api

handlers:
  - url: /api/
    script: auto
  - url: /
    script: auto

client.yaml

runtime: nodejs12
service: client

handlers:
  - url: /static/js/(.*)
    static_files: build/static/js/\1
    upload: build/static/js/(.*)
  - url: /static/css/(.*)
    static_files: build/static/css/\1
    upload: build/static/css/(.*)
  - url: /static/media/(.*)
    static_files: build/static/media/\1
    upload: build/static/media/(.*)
  - url: /(.*\.(json|ico|png))$
    static_files: build/\1
    upload: build/.*\.(json|ico|png)$
  - url: /
    static_files: build/index.html
    upload: build/index.html
    http_headers:
      Access-Control-Allow-Origin: "*"
  - url: /.*
    static_files: build/index.html
    upload: build/index.html
    http_headers:
      Access-Control-Allow-Origin: "*"

【问题讨论】:

  • 您能否确认您是否遵循了有关“Mapping Custom Domains”的文档?如果没有,请确保文档中所述的所有步骤。另外,请记住,您可以使用挖掘工具检查您的 DNS 记录是否已更新,如同一文档中所述。
  • 嗨,我确实按照那里的文件进行了操作。使用文章中的 dig 工具,看起来确实添加了 DNS 记录。查询基本“mydomain.app”url 会显示我添加到域的 DNS 记录中的 A 记录。查询“www.mydomain.app”也会返回 ghs.googlehosted.com 地址。还有一个 NOERROR 响应。
  • 在这种情况下,我建议您通过Google Issue Tracker 开票或联系支持人员,以便他们检查您的项目并解决此问题。
  • @tzovourn 谢谢 - 我已经提出了这个问题,希望能够得到答复

标签: node.js google-app-engine networking dns subdomain


【解决方案1】:

确实是最愚蠢的错误之一 - 我在某个时候切换了 gcloud 项目并忘记使用 gcloud init 重新初始化。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-04
    • 1970-01-01
    • 2021-11-02
    • 2017-04-08
    • 2015-11-07
    • 2012-06-10
    • 1970-01-01
    相关资源
    最近更新 更多