Home > Back-end >  Catch inexistent static files in app.yaml
Catch inexistent static files in app.yaml

Time:11-28

In app.yaml I have

- url: /(. \.(gif|png|jpg))$
  static_files: \1
  upload: . \.(gif|png|jpg)$

- url: .*
  script: auto

I would like to intercept / redirect non existent image files (gif | png | jpg).

As it is, GAE returns an Error not found when requesting some inexistent file with the image extensions, I am looking if there's some way -at app.yaml- level to intercept them. (I could remove the static images URL entry and handle everything in code but I wonder if there's a way in app.yaml)

CodePudding user response:

Adding

error_handlers:
  - file: router.php

works. The router being a script runs and can parse the original URL and act.

  • Related