【问题标题】:Nuxt static site on GAE 404 on page refresh页面刷新时 GAE 404 上的 Nuxt 静态站点
【发布时间】:2021-01-17 15:17:12
【问题描述】:

我知道已经有几篇关于这个主题的帖子,但是我没有让这个东西在推荐的设置下工作。当我使用以下命令在本地生成并启动我的 Nuxt 静态站点时,一切正常。即使我刷新页面,也会显示相同的路线。

nuxt generate && nuxt start

当我将我的 dist 文件夹部署到 Google App Engine 时,该网站似乎运行得非常棒。但是,只要我点击刷新按钮,就会显示 404。我的app.yaml 如下:

---
runtime: python37
instance_class: F1

handlers:
- url: /
  static_files: index.html
  upload: index.html
  secure: always
- url: /(.*)
  static_files: \1
  upload: (.*)
  secure: always

适用nuxt.config.js设置:

ssr: true
target: 'static'

【问题讨论】:

    标签: google-app-engine google-cloud-platform nuxt.js


    【解决方案1】:

    设法在app.yaml 中解决了这个问题,但不能 100% 确定为什么会发生这种情况。它可能与最后的“包罗万象”处理程序有关。这是我的工作示例:

    ---
    runtime: python37
    instance_class: F1
    
    handlers:
      - url: /(.*\..+)$
        static_files: \1
        upload: (.*\..+)$
      - url: /.*
        static_files: index.html
        upload: index.html
    

    【讨论】:

      猜你喜欢
      • 2019-11-27
      • 1970-01-01
      • 2020-12-30
      • 2020-06-02
      • 2013-07-28
      • 2020-07-23
      • 2013-05-07
      • 2020-07-06
      • 1970-01-01
      相关资源
      最近更新 更多