Skip to content
Advertisement

Catch inexistent static files in app.yaml

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)

Advertisement

Answer

Adding

error_handlers:
  - file: router.php

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

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement