> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom headers

> Send custom HTTP headers to your web server.

## Available device variables for custom headers

Your app can send custom headers to the web server using two device variables, which can be combined with constant strings or defined values:

`%DEVICEID%`: Sends the device’s unique identifier.

`%DEVICENAME64%`: Sends the device’s name as a Base64-encoded UTF-8 string (for example, "Robert's iPhone").

These device variables allow you to dynamically send device-specific data with each request, ensuring that your server can handle requests based on the actual device information.

## Editing the appConfig.json file for custom header configuration

You can configure the custom headers by editing the `appConfig.json` file directly in your app's source code. To set up the custom headers, add the following fields under the "general" section in the Import/Export section of the configuration.

### Example configuration for Android and iOS

```json JSON theme={null}
"general": {
    "androidCustomHeaders": {
        "x-median-example-parameter": "example_value",
        "x-median-app-version": "android_app_v5",
        "x-median-device-id": "%DEVICEID%",
        "x-median-device-name": "%DEVICENAME64%"
    },
    "iosCustomHeaders": {
        "x-median-example-parameter": "example_value",
        "x-median-app-version": "ios_app_v5",
        "x-median-device-id": "%DEVICEID%",
        "x-median-device-name": "%DEVICENAME64%"
    }
}
```

In this example, the custom headers for both Android and iOS apps include a version identifier, device ID, and device name encoded in Base64.

## Important notes on custom headers

* **Header inclusion**: Custom headers are only included in the initial document request. Other resource types like CSS, JS, images, or AJAX requests will not carry these custom headers to maintain fast performance.
* **Performance consideration**: While custom headers are crucial for some use cases, it's essential to limit the number of headers in requests to ensure fast performance, especially for static resources.

## Testing custom headers

To test the custom headers in your app:

1. Go to your app’s Private Management URL.
2. Enable Debug Mode below the Device Simulator.
3. Open the DevTools window.
4. Inspect the network traffic and request headers to verify that the custom headers are being sent correctly.

This allows you to monitor real-time network requests and ensure that your custom headers are configured and transmitted as expected.


## Related topics

- [Detecting app usage](https://docs.median.co/docs/detecting-app-usage.md)
- [Website overrides overview](https://docs.median.co/docs/website-overrides-overview.md)
- [Changelog archive](https://docs.median.co/docs/changelog-archive.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.