---
title: "Usage"
version: "1.3"
permalink: "https://docs.typo3.org/permalink/codemacher/tile_proxy:usage@1.3"
source: "Usage/Index.rst"
rendered: "2026-11-10T09:04:46+00:00"
---

# Usage {#usage}

## Tile-Proxy-Endpoint {#tile-proxy-endpoint}

With this extension you can define a page in the TYPO3 backend as an endpoint for maps.

If the slug for your page is e.g. tile-proxy, the data can be retrieved from:

```javascript
/tile-proxy/?provider=osm&z={z}&x={x}&y={y}&s={s}
```

### Arguments {#arguments}

**provider**

Currently only osm (OpenStreetMap) is supported, so the value must be osm.

**z**

zoom level ([https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames))

**x**

x-tile coordinate ([https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames))

**y**

y-tile coordinate ([https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames))

**s**

OSM subdomain for CDN

If the tile must be loaded and is not cached, this request will be mapped to:

```javascript
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
```

The http referrer must be your own domain, localhost or configured in page settings or extension configuration. If these options do not offer enough flexibility, you can implement your own logic for verifying the referrer via a listener to the PSR-14 event `\Codemacher\TileProxy\Event\IsReferrerAllowedEvent` (see [usage example](https://docs.typo3.org/permalink/codemacher/tile_proxy:usage-miscellaneous-is-referrer-allowed-event@1.3)). If none of these options accept the referrer, you will receive error 1001.

**Keep in mind:** A referrer header can be spoofed, so this is not a strict access control check!

#### Leaflet Example {#leaflet-example}

```javascript
// Initialize the base layer
L.tileLayer('/tile-proxy/?provider=osm&z={z}&x={x}&y={y}&s={s}', {
  attribution: '&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',

}).addTo(map);
```

#### OpenLayer Example {#openlayer-example}

```javascript
var osmSource = new ol.source.XYZ({
    attributions : '&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
    urls: [
      '/tile-proxy/?provider=osm&z={z}&x={x}&y={y}&s=a',
      '/tile-proxy/?provider=osm&z={z}&x={x}&y={y}&s=b',
      '/tile-proxy/?provider=osm&z={z}&x={x}&y={y}&s=c',
    ]
});
```

## Nominatim-Proxy-Endpoint {#nominatim-proxy-endpoint}

With this extension you can define a page in the TYPO3 backend as an endpoint for geocoding request to nominatim.

If the slug for your page is e.g. geo-proxy, the data can be retrieved from:

```javascript
/geo-proxy/?provider=osm&apitype=search&q=06120&format=json&addressdetails=1
```

### Arguments {#arguments-1}

**provider**

Currently only osm (OpenStreetMap) is supported, so the value must be osm.

**apitype**

Type of the api endpoint.
Permissible types are: 'search','reverse','lookup'
see [https://nominatim.org/release-docs/latest/api/Overview/](https://nominatim.org/release-docs/latest/api/Overview/)

**all other paramers**

all other parameters are forwarded directly to the nominatim-api.

If the request must be loaded and is not cached, this request will be mapped to:

```javascript
https://nominatim.openstreetmap.org/search?q=06120&format=json&addressdetails=1
```

The http referrer must be your own domain, localhost or configured in page settings or extension configuration. If these options do not offer enough flexibility, you can implement your own logic for verifying the referrer via a listener to the PSR-14 event `\Codemacher\TileProxy\Event\IsReferrerAllowedEvent` (see [usage example](https://docs.typo3.org/permalink/codemacher/tile_proxy:usage-miscellaneous-is-referrer-allowed-event@1.3)). If none of these options accept the referrer, you will receive error 1001.

**Keep in mind:** A referrer header can be spoofed, so this is not a strict access control check!

## Miscellaneous {#miscellaneous}

### `\Codemacher\TileProxy\Event\IsReferrerAllowedEvent` {#usage-miscellaneous-is-referrer-allowed-event}

This event is dispatched on a request to one of the proxy endpoints, when checking if the current HTTP request is permitted to access the endpoint by containing a valid referrer. A listener with custom logic can be implemented, if the existing whitelisting options do not offer enough flexibility.

By calling `setAllowed(true)` on the event object, the request is permitted to access the endpoint. See also the example below.

The event object also provides some context about the current request:

-   `getRequest()`: The current PSR-7 request object.
-   `getPageRecord()`: An associative array containing the properties of the current page record.
-   `getFlexSettings()`: An associative array containing the parsed flexform properties of the current page record.
-   `getReferrer()`: The raw value of the current request's referrer header
-   `getReferrerDomain()` The host part of the referrer header, e.g. `www.example.org`

As the event implements `StoppableEventInterface`, propagation can be stopped via calling `stopPropagation()`

#### Example: Allow the wildcard subdomain `*.example.org`: {#example-allow-the-wildcard-subdomain-example-org}

**EXT:my_extension/Classes/EventListener/IsReferrerAllowedEventListener.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use Codemacher\TileProxy\Event\IsReferrerAllowedEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
    identifier: 'my-extension/tile-proxy-referrer'
)]
readonly class IsReferrerAllowedEventListener
{
    public function __invoke(IsReferrerAllowedEvent $event): void
    {
        if (preg_match('/^.+\\.example\\.org$/', $event->getReferrerDomain()) === 1) {
            $event->setAllowed(true);
            $event->stopPropagation();
        }
    }
}

```
