Manual Chapter : Returning HTTP Status 503 to Web Applications

Applies To:

Show Versions Show Versions

BIG-IP APM

  • 13.0.1, 13.0.0
Manual Chapter

Overview: Returning HTTP status code 503 for APM-generated error pages

Access Policy Manager® (APM®) sends an error page to a web application when, for example, the application sends a request to a non-existent domain name or uses a URL that is blocked by the configuration. By default, the error page is a human-readable HTML page with HTTP status 200. This can lead to errors if the web application expects an error status or error notifications, but receives a normal reply. Instead, proxy servers can reply with HTTP status 503. Current browsers display the content of HTTP 503 replies to the user, if possible, and client code can recognize an abnormal situation.

To change the default behavior to reply with HTTP status code 503 for an APM-generated error page, you can configure an access profile or an access policy.

  • To change the default behavior for any client session created through the access profile, configure a setting in the access profile.
  • To change the default behavior for a client session based on any criteria that you want, configure logic (and a session variable) in the access policy.

Configuring an access profile to return HTTP status code 503

For Access Policy Manager® (APM®) to return an HTTP status code 503 for APM-generated error pages, you can select Use HTTP Status 503 for Error Pages in the access profile.
  1. On the Main tab, click Access > Profiles / Policies .
    The Access Profiles (Per-Session Policies) screen opens.
  2. Click the name of the access profile that you want to edit.
    The properties screen opens.
  3. For Settings, select the Custom check box.
    The settings become available to edit.
  4. Select the Use HTTP Status 503 for Error Pages check box.
  5. Click Finished.
For APM-generated error pages, APM returns HTTP status code 503 instead of HTTP 200 for traffic on the virtual server associated with this access profile.

Configuring an access policy to return HTTP status code 503

You can set the value of the session.error.use503 session variable in an access policy to change the HTTP status code that Access Policy Manager® (APM®) returns for error pages that APM generates. If you enable the session variable, APM responds with HTTP status 503. If you disable the session variable later on the branch, APM goes back to returning HTTP status 200, which is the default behavior.
Note: If the Use HTTP Status 503 for Error Pages check box is selected in the access profile, changing the value of the session.error.use503 session variable in an access policy has no effect.
  1. On the Main tab, click Access > Profiles / Policies .
    The Access Profiles (Per-Session Policies) screen opens.
  2. In the Per-Session Policy column, click the Edit link for the access profile you want to configure.
    The visual policy editor opens the access policy in a separate screen.
  3. Add items to the policy to specify the criteria under which you want APM to return HTTP status 503.
  4. On the policy branch where you want APM to return HTTP status 503, click the (+) icon to add an item to the policy.
    A popup screen displays actions on tabs, such as General Purpose and Authentication, and provides a search field.
  5. On the Assignment tab, select Variable Assign and click Add Item.
    A properties screen opens.
  6. Click Add new entry.
    An Empty entry displays.
  7. Click the change link next to the empty entry.
    A dialog box, where you can enter a variable and an expression, opens.
  8. On the left side, retain the default setting, Custom Expression, and in the field type session.error.use503.
  9. On the right side, select text from the list and set the value of the session variable:
    • To use HTTP status 503 for APM-generated error pages, type any letter or word in the field, such as t.
    • To restore the default behavior (use the HTTP status 200 for error pages), remove all text from the field.
  10. Click Finished to save the variable and expression and return to the Variable Assign action popup screen.
  11. Click Save.
    The properties screen closes and the policy displays.
  12. Click the Apply Access Policy link to apply and activate the changes to the policy.