4

My React App is already running on GCP engine. Navigation and all the pages look fine but direct links are causing issues - for example, if I open myWebsite.com/vacancies, I'll get the error log saying that Static file referenced by handler not found: public/vacancies//index.html. Here's my app.yaml handlers config:

handlers:
  - url: /
    static_files: public/index.html
    upload: public/index.html

  - url: /((.*\/)*[^\/]+\.[^\/]+)$
    static_files: public/\1
    upload: public/.*

  - url: /(.*)$
    static_files: public/\1/index.html
    upload: public/.*/index.html

The workaround is opening the page like this myWebsite.com/vacancies/index.html, but I'd like to find more smooth solution. Thanks in advance

LirysJH
  • 184
  • 2
  • 15

2 Answers2

0

This error is mainly caused by a problem in the app.yaml file, it can be caused if static file handlers redirects to a file that does not exist or the file name mentioned is incorrect. Please make sure you are using an updated version for the language and the name mentioned in the file is correct.

You can refer to the public Documentation where reference for the App.yaml file is provided, you can also refer to the stackoverflow answers for the post1 and post2 where a brief description for the app.yaml handlers configuration has been provided for the static website.

Divyani Yadav
  • 1,030
  • 4
  • 9
0

The solution for my case:

  - url: /(.*)\/$
    static_files: public/\1/index.html
    upload: public/.*index.html

  - url: /(.*)$
    static_files: public/\1/index.html
    upload: public/.*/index.html
LirysJH
  • 184
  • 2
  • 15