【问题标题】:App engine is not serving images of public folder in react应用程序引擎未在反应中提供公用文件夹的图像
【发布时间】:2021-12-31 16:16:24
【问题描述】:

我在应用引擎中托管了一个反应应用程序,我在公共文件夹中有很多图片如何在我的本地机器中正确显示,但是当我在标准环境中部署它时,所有文件都已部署,我检查了网址图像中的来源,他为它们提供服务,但它们似乎已损坏(当我下载它们时)也许我在配置中做错了什么?我唯一可以访问的是网站图标。这就是我在源代码中得到的。

我的 app.yaml 是:

runtime: nodejs12   
service: default    
instance_class: F4_1G
handlers:
   - url: /static
    static_dir: build/static

   - url: /assets
    static_dir: build/assets

  - url: /(.*\.(json|ico|js))$
    static_files: build/\1
    upload: build/.*\.(json|ico|js)$

  - url: .*
    static_files: build/index.html
    upload: build/index.html

【问题讨论】:

    标签: reactjs google-app-engine google-cloud-platform google-cloud-build app.yaml


    【解决方案1】:

    您的app.yaml 没有/media 的处理程序。所以GCP在访问viper8.JPG时返回index.html。为/media 添加处理程序。

    【讨论】:

    • 谢谢你,它就像一个魅力
    猜你喜欢
    • 1970-01-01
    • 2021-05-20
    • 2013-03-11
    • 1970-01-01
    • 1970-01-01
    • 2022-08-14
    • 2023-04-07
    • 2021-11-05
    • 1970-01-01
    相关资源
    最近更新 更多