百度智能云

All Product Document

          CDN

          Set the Custom Error Page

          In case of an error in website access, the browser will display corresponding error page, and this interface can be used to customize the error page.

          Method Path Description
          PUT /v2/domain/{domain}/config?errorPage Custom error page

          domain: CDN accelerated domain name.

          Request body

          Parameter Optional Type Description
          errorPage Required list type, element type is ErrorPage Detailed configuration of custom error redirection page

          ErrorPage:

          Parameter Optional Type Description
          code Required int The specific status code must be the standard error code of HTTP, and cannot be such special status code as 408, 444 or 499 and others concerning client exception/early disconnection.
          redirectCode Optional int Redirect status code, the type of redirection when an error code appears. You can select 301 or 302, and the default is 302.
          url Required String Redirect the target address , in case of an error code, redirect to this user-defined url.

          Response code (Http Status Code)

          HTTP Status Code Description
          200 Success
          400 Update failures, parameter errors, etc.

          Request example

          PUT /v2/domain/myself.baidu.com/config?errorPage HTTP/1.1 
          Host: cdn.baidubce.com 
          Content-Length: 112
          Content-Type: application/json
          
          { 
          "errorPage":[ 
              { 
                  "code":404, 
                  "redirectCode":302, 
                  "url":"/customer_404.html" 
              }, 
              { 
                  "code":403, 
                  "url":"/custom_403.html" 
              } 
            ] 
          } 

          Response example

          HTTP/1.1 200 OK 
          Content-Type: application/json; charset=utf-8 
          Transfer-Encoding: chunked 
          
          { 
              "status":"RUNNING" 
          } 
          Previous
          Query the Cache Parameter Filter Rules
          Next
          Query the Custom Error Page