---
name: azion-serve-a-status-page-from-a-function
description: >-
  Serve a status or error page from the Hello World function on an application, with a function instance and a Rules Engine rule, and no request to the origin.
---

# Serve a status page from a function

You can serve a status or error page from the Hello World function on an application, from Azion Console. The function answers on Azion's distributed infrastructure, so the request never reaches your origin. To install Hello World from Azion Marketplace with a status code and a body instead, refer to [Install the Hello World integration](/en/documentation/guides/application-development/integrations/hello-world/).

A status page reports the state of a service, so you can monitor it and inform its users. The example on this page answers requests to `www.myapplication.com/api_service` with a notice that the service is temporarily unavailable. With [Data Stream](/en/documentation/platform/data-stream/), you can also send the access records of the page to a SIEM (Security Information and Event Management), Big Data, or log servers, and analyze the data there.

---

## Prerequisites

- Access to Azion Console. To sign in, refer to [How to access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).
- An [application](/en/documentation/platform/applications/) that receives the requests for the status page.
- Application Accelerator and [Functions](/en/documentation/platform/functions/) turned on for the application. The *Run Function* behavior requires both. For more information, refer to [Rules Engine for Applications](/en/documentation/platform/applications/rules-engine/#run-function).

---

## Create the function instance

An application runs a function through an instance, and the instance passes its Args to the function. Azion provides the Hello World function, and its Args set the HTTP status code and the message of the response. The example instance uses these Args:

```json
{
    "param":{
        "http_status": 503,
        "body": "We are working hard to serve you better!"
    }
}
```

To create the instance in Azion Console:

1. **Open the application**

   Access [Azion Console](https://console.azion.com/) > **Applications**, then select the application that serves the status page.

2. **Go to the Functions Instances tab**

3. **Select + Function Instance**

4. **Name the instance**

   Enter a distinctive name. For example: `MyHelloWorld`.

5. **Select the function**

   In the **Function** field, select *Hello World*. The **Code** field shows the code of the function for reference only.

6. **Enter the Args**

   In the **Args** tab, enter the JSON with your status code and message.

7. **Select Save**

The `MyHelloWorld` instance is on the application. It runs only after a Rules Engine rule selects it.

---

## Add the rule that runs the instance

A Rules Engine rule sets the criteria a request must meet and the behaviors that run when it does. You can add the behavior to the Default Rule or create a new rule. Here, a new rule runs `MyHelloWorld` when the URI starts with `/api_service`.

To create the rule in Azion Console:

1. **Open the application**

   Access [Azion Console](https://console.azion.com/) > **Applications**, then select the application that serves the status page.

2. **Select the Rules Engine tab**

3. **Select + Rule**

4. **Name the rule**

   Enter a name for the rule.

5. **Set the criterion**

   In the **Criteria** section, select `${uri}` as the variable and `starts_with` as the operator, and enter `/api_service` as the argument.

6. **Add the behavior**

   In the **Behaviors** section, select *Run Function*, then select `MyHelloWorld`.

7. **Select Save**

A request to `www.myapplication.com/api_service` returns the status code `503` with the body `We are working hard to serve you better!`.

---

## Next steps

- [Stream request and WAF records to a SIEM](/en/documentation/guides/platform/observability/stream-request-and-waf-records-to-siem.md): Send the access records of the application to a SIEM with Data Stream.
- [Run a function on an application](/en/documentation/guides/application-development/functions-and-runtime/serverless-functions.md): Add the rule that runs a function instance from Azion Console or the Azion API.
- [Function instances](/en/documentation/platform/applications/functions-instances.md): Read every field of an instance and the limit on its Args.
- [Functions](/en/documentation/platform/functions.md): Write your own function to serve a page.
