Google App Engine and 404 error

前端 未结 9 1224
一生所求
一生所求 2020-12-02 06:46

I\'ve setup a static website on GAE using hints found elsewhere, but can\'t figure out how to return a 404 error. My app.yaml file looks like

- url: (.*)/
           


        
9条回答
  •  不思量自难忘°
    2020-12-02 06:58

    The dev_appserver is already returning 404 responses for anything that doesn't match the mapping, or does match the mapping but doesn't exist. The 404 response itself has no body, but it's still a 404:

    $ wget -O - http://127.0.0.1:8080/foo
    --2010-10-28 10:54:51--  http://127.0.0.1:8080/foo
    Connecting to 127.0.0.1:8080... connected.
    HTTP request sent, awaiting response... 404 
    2010-10-28 10:54:51 ERROR 404: (no description).
    
    $ wget -O - http://127.0.0.1:8080/foo/
    --2010-10-28 10:54:54--  http://127.0.0.1:8080/foo/
    Connecting to 127.0.0.1:8080... connected.
    HTTP request sent, awaiting response... 404 
    2010-10-28 10:54:54 ERROR 404: (no description).
    

    If you want to return a more user-friendly error page, follow jonmiddleton's advice and specify a custom 404 page.

提交回复
热议问题