---
title: "Panel Configuration"
description: "Where the Panel's preview button sends an editor, and what a browser gets when it opens the backend URL directly."
canonical_url: "https://kirby.tools/docs/headless/configuration/panel"
---

# Panel Configuration

> Where the Panel's preview button sends an editor, and what a browser gets when it opens the backend URL directly.

## Frontend Preview URLs

In headless setups, Panel preview links point to the backend by default. Use the `frontendUrl` page method to redirect preview links to your frontend application.

### Blueprint Configuration

Set the `preview` option in your blueprint to use the `frontendUrl` method:

```yaml [site/blueprints/pages/default.yml]
options:
  preview: "{{ page.frontendUrl }}"
```

For the site blueprint, use `site.frontendUrl`:

```yaml [site/blueprints/site.yml]
options:
  preview: "{{ site.frontendUrl }}"
```

### Config Setup

Configure your frontend URL in `config.php`:

```php [config.php]
return [
    'headless' => [
        'panel' => [
            'frontendUrl' => 'https://example.com'
        ]
    ]
];
```

<note>

Without `frontendUrl`, the `frontendUrl` page and site methods return `null`. A blueprint that builds its preview URL from them ends up with an empty one – Kirby still renders the preview button, it just leads nowhere.

</note>

## Panel Redirect

For headless-only projects, automatically redirect visitors to the Panel when they access your backend URL. This is useful when your Kirby installation serves no frontend content.

```php [config.php]
return [
    'headless' => [
        'globalRoutes' => true,
        'panel' => [
            'redirect' => true
        ]
    ]
];
```

The redirect lives in the global catch-all route, so it takes effect only with `headless.globalRoutes` enabled – or in your own route built with `Middlewares::hasBearerToken(true)`. A request that arrives there without an `Authorization` header is sent to the Panel, but only if it carries an `Accept` header asking for something other than JSON, which is what a browser navigation does. A client that asks for JSON is answered with JSON, and so is a client that sends no `Accept` header at all.

---

Every page of this site as Markdown: <https://kirby.tools/sitemap.md>
