PHPackages                             ecphp/reverse-proxy-helper-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. ecphp/reverse-proxy-helper-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

ecphp/reverse-proxy-helper-bundle
=================================

Helper bundle, configure the request headers from a given base URL.

1.0.6(4y ago)04.9k↓100%1[2 PRs](https://github.com/ecphp/reverse-proxy-helper-bundle/pulls)BSD-3-ClausePHPPHP &gt;= 7.2.5

Since Mar 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ecphp/reverse-proxy-helper-bundle)[ Packagist](https://packagist.org/packages/ecphp/reverse-proxy-helper-bundle)[ Docs](http://github.com/ecphp/reverse-proxy-helper-bundle)[ RSS](/packages/ecphp-reverse-proxy-helper-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (10)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/4695366a965fe0c65c70d18a7153a974ff43893590c6c67e7c974fbed906ae64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ecphp/reverse-proxy-helper-bundle)[![GitHub stars](https://camo.githubusercontent.com/a86d95f31d5296d09c5909e9f63e53f79bfe061e7327e72b327bffd2e8cb6bf9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ecphp/reverse-proxy-helper-bundle)[![Total Downloads](https://camo.githubusercontent.com/263d71900f9997cb0eb3d490d4d2be958b1c3c76d2e27a0aa1b7b667bf914a90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ecphp/reverse-proxy-helper-bundle)[![GitHub Workflow Status](https://camo.githubusercontent.com/1f6aed86b6c14315364e701144de506f6f5958da1f88f586a15c31b51797ab84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652f436f6e74696e756f7573253230496e746567726174696f6e2f6d61737465723f7374796c653d666c61742d737175617265)](https://github.com/ecphp/reverse-proxy-helper-bundle/actions)[![Scrutinizer code quality](https://camo.githubusercontent.com/ffe03dcf1c114621ac943ea6395c95683041525ad6283dd29982927b3ee3c0e0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ecphp/reverse-proxy-helper-bundle/?branch=master)[![Type Coverage](https://camo.githubusercontent.com/ff9266a4e0c8ff51dcbadf998b8b27d4587b3724fa5548fe7a8b807f51d5fa7a/68747470733a2f2f73686570686572642e6465762f6769746875622f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652f636f7665726167652e737667)](https://shepherd.dev/github/ecphp/reverse-proxy-helper-bundle)[![Code Coverage](https://camo.githubusercontent.com/b4eabbec4667757af3b4a6e59b8ab8789068c48d4cc9e56b0634c94eb047848b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ecphp/reverse-proxy-helper-bundle/?branch=master)[![License](https://camo.githubusercontent.com/f8a443dbee16162246d89c10695ab5bad018f034fa19dc2c4e89a0ce5ec54ee5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f65637068702f726576657273652d70726f78792d68656c7065722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ecphp/reverse-proxy-helper-bundle)

Reverse Proxy Helper Bundle
===========================

[](#reverse-proxy-helper-bundle)

At European Commission, many applications are behind a reverse proxy server.

If the reverse proxy configuration is not properly set, Symfony applications will generate invalid URIs because they will use their internal server URIs instead of the one given by the reverse proxy.

For some reason, the reverse proxy services at European Commission doesn't send all the necessary headers to let Symfony generate proper URIs.

This bundle will make sure that the URIs are properly generated by providing the missing headers and set the appropriate trusted proxies configuration.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2.5
- Symfony &gt;= 5.2.4

Installation
------------

[](#installation)

```
composer require ecphp/reverse-proxy-helper-bundle
```

Then, in your Symfony application, create a new configuration file `reverse-proxy-helper.yaml` in `config/packages`:

```
    reverse_proxy_helper:
        base_url: https://frontend-url-foobar:12345/app1/
```

You may also move this file in a specific environment if needed, and modulate the configuration based on the environment.

You can also use environment variables as well:

Update your configuration file as such to use an environment variable `REVERSE_PROXY_URL`:

```
    reverse_proxy_helper:
        base_url: '%env(resolve:REVERSE_PROXY_URL)%'
```

You also need to configure the `trusted_headers` and `trusted_proxies` in `framework.yaml`, example:

```
framework:
    trusted_proxies: '127.0.0.1,REMOTE_ADDR'
    trusted_headers: ['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix']
```

What does this do?
------------------

[](#what-does-this-do)

This bundle ensures that proper headers are set for HTTP requests behind a reverse proxy.

Setting a trusted proxy and proper headers allows for correct URL generation, redirecting, session handling and logging in Symfony when behind a reverse proxy.

This is useful if your web servers sit behind a load balancer (*Nginx, HAProxy, Envoy, ELB/ALB, etc*), HTTP cache (*CloudFlare, Squid, Varnish, etc*), or other intermediary (*reverse*) proxy.

Why does this matter?
---------------------

[](#why-does-this-matter)

A very common load balancing approach is to send `https://` requests to a load balancer, but send `http://` requests to the application servers behind the load balancer.

For example, you may send a request in your browser to `https://example.org`. The load balancer, in turn, might send requests to an application server at `http://192.168.1.23`.

What if that server returns a redirect, or generates an asset url? The users's browser would get back a redirect or HTML that includes `http://192.168.1.23` in it, which is clearly wrong.

What happens is that the application thinks its hostname is `192.168.1.23` and the schema is `http://`. It doesn't know that the end client used `https://example.org` for its web request.

So the application needs to know to read the `X-Forwarded` headers to get the correct request details (schema `https://`, host `example.org`).

Symfony is able to reads those headers, but only if the trusted proxy configuration is correctly set to "trust" the load balancer/reverse proxy.

How does this work?
-------------------

[](#how-does-this-work)

Applications behind a reverse proxy typically read some HTTP headers such as `X-Forwarded-*`, (`X-Forwarded-For`, `X-Forwarded-Proto`, `X-Forwared-Host`, `X-Forwarded-Port`, `X-Forwarded-Prefix`) to know about the real end-client making an HTTP request.

> If those headers were not set, then the application code would think every incoming HTTP request would be from the proxy.

The Symfony HTTP base classes have a concept of a "trusted proxy", where those `X-Forwarded-*`headers will only be used if the source IP address of the request is known.

This package creates an easier interface to that option. You can set the IP addresses of the proxies (*that the application would see, so it may be a private network IP address*), and Symfony will use the `X-Forwarded-*` headers if an HTTP request containing those headers was from the trusted proxy.

Open Source contributions
-------------------------

[](#open-source-contributions)

- symfony/framework-bundle: [\#40281](https://github.com/symfony/symfony/pull/40281)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~6 days

Total

7

Last Release

1778d ago

PHP version history (2 changes)1.0.0PHP &gt;= 7.4

1.0.1PHP &gt;= 7.2.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/252042?v=4)[Pol Dellaiera](/maintainers/drupol)[@drupol](https://github.com/drupol)

![](https://www.gravatar.com/avatar/96d984045c84130d019f84c8942418fa1e4966fb9705b859922b5c2071b526eb?d=identicon)[ecphp](/maintainers/ecphp)

---

Top Contributors

[![drupol](https://avatars.githubusercontent.com/u/252042?v=4)](https://github.com/drupol "drupol (64 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")

---

Tags

headersreverse proxy

### Embed Badge

![Health badge](/badges/ecphp-reverse-proxy-helper-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ecphp-reverse-proxy-helper-bundle/health.svg)](https://phpackages.com/packages/ecphp-reverse-proxy-helper-bundle)
```

###  Alternatives

[paragonie/csp-builder

Easily add and update Content-Security-Policy headers for your project

5412.8M18](/packages/paragonie-csp-builder)[amphp/hpack

HTTP/2 HPack implementation.

1098.5M7](/packages/amphp-hpack)[delight-im/http

Hypertext Transfer Protocol (HTTP) utilities for PHP

191.3M4](/packages/delight-im-http)[bakame/http-structured-fields

A PHP library that parses, validates and serializes HTTP structured fields according to RFC9561 and RFC8941

442.6k4](/packages/bakame-http-structured-fields)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
