Laravel Google App Engine Public files not found

I am currently deploying a Laravel + Vue app on Google App Engine, and I have been able to set up the app on Google App Engine. However, after deployment, while the routes are accessible, none of the Image files, Stylesheets and Javascript files in the Public folder are readable and returns a 404 error.

Here is my app.yaml file (Variable Data has been removed for obscurity reasons)

runtime: php72

env_variables:
  ## Put production environment variables here.
  APP_KEY: <key>
  APP_STORAGE: /tmp
  VIEW_COMPILED_PATH: /tmp
  CACHE_DRIVER: database
  SESSION_DRIVER: cookie
  ## Set these environment variables according to your CloudSQL configuration.
  DB_DATABASE: db
  DB_USERNAME: root
  DB_PASSWORD: password
  ## for MYSQL, use DB_SOCKET:
  DB_SOCKET: "/cloudsql/YOUR_CONNECTION_NAME"
  ## for PostgreSQL, use DB_HOST:
  # DB_HOST: "/cloudsql/YOUR_CONNECTION_NAME"

Also, I would like to know how to run the command npm run dev so that the JS files get updated.

Thanks in advance.

Upvotes: 1

Views: 1017

Answers (1)

Coola
Coola

Reputation: 3142

If you are using Google App Engine standard environment, you need to add the handlers to your app.yaml file.

Example:

runtime: php72

handlers:
- url: /(.*\.(gif|png|jpg|css|js))$
  static_files: public/\1
  upload: public/.*\.(gif|png|jpg|css|js)$

- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto
  

Upvotes: 6

Related Questions