PHPackages                             csun-metalab/laravel-proxypass - 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. csun-metalab/laravel-proxypass

ActiveLibrary[HTTP &amp; Networking](/categories/http)

csun-metalab/laravel-proxypass
==============================

Composer package for Laravel that resolves the correct absolute URLs when behind a proxy

1.1.0(8y ago)015.5k↓66.7%1MITPHPPHP &gt;=5.5.9

Since Nov 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PioneeringTechLab/laravel-proxypass)[ Packagist](https://packagist.org/packages/csun-metalab/laravel-proxypass)[ RSS](/packages/csun-metalab-laravel-proxypass/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (1)

Laravel Proxy Pass
==================

[](#laravel-proxy-pass)

[![Latest Stable Version](https://camo.githubusercontent.com/aeb9cc01fb0a4250d5c96de036371ce323b93937e8fde12c82e15a690626c366/68747470733a2f2f706f7365722e707567782e6f72672f6373756e2d6d6574616c61622f6c61726176656c2d70726f7879706173732f762f737461626c65)](https://packagist.org/packages/csun-metalab/laravel-proxypass) [![Total Downloads](https://camo.githubusercontent.com/7776cd60953724530eac7ded3a94ad3d1cd1afe585c70ad1b67edcac1f0f0b36/68747470733a2f2f706f7365722e707567782e6f72672f6373756e2d6d6574616c61622f6c61726176656c2d70726f7879706173732f646f776e6c6f616473)](https://packagist.org/packages/csun-metalab/laravel-proxypass) [![License](https://camo.githubusercontent.com/513894fab8226bbdb500d5924cd304786e69412a54e70a59c68ee90265abaab5/68747470733a2f2f706f7365722e707567782e6f72672f6373756e2d6d6574616c61622f6c61726176656c2d70726f7879706173732f6c6963656e7365)](https://packagist.org/packages/csun-metalab/laravel-proxypass)

Composer package for Laravel that resolves the correct absolute URLs when behind a proxy.

This package is built for version 5.0 of Laravel and above. It modifies the functionality of the `url()`, `asset()`, and other helper methods.

To install from Composer, use the following command:

```
composer require csun-metalab/laravel-proxypass

```

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

[](#installation)

First, add the following lines to your .env file to leverage the proxy attributes:

```
PROXY_ACTIVE=true
PROXY_PATH_HEADER=HTTP_X_FORWARDED_PATH

```

You may also add the following optional lines to your .env file to leverage the ability to FORCE the URL and schema without having to pass through a load balancer or proxy:

```
# http or https: PUBLIC_SCHEMA_OVERRIDE=https
PUBLIC_SCHEMA_OVERRIDE=

# Example: PUBLIC_URL_OVERRIDE=http://some-other-domain.example.com/some-other-directory
PUBLIC_URL_OVERRIDE=

```

Next, add the service provider to your `providers` array in Laravel as follows:

```
'providers' => [
   //...

   CSUNMetaLab\ProxyPass\Providers\ProxyPassServiceProvider::class,

   // You can also use the following depending on Laravel convention:
   // 'CSUNMetaLab\ProxyPass\Providers\ProxyPassServiceProvider',

   //...
],

```

Finally, run the following Artisan command to publish the configuration:

```
php artisan vendor:publish

```

Environment Variables
---------------------

[](#environment-variables)

The two environment variables you added to your .env file are the following:

### PROXY\_ACTIVE

[](#proxy_active)

Set this to `true` to enable the proxying functionality or `false` to disable it.

### PROXY\_PATH\_HEADER

[](#proxy_path_header)

This is the PHP-interpreted value of the request header sent from your proxy. The default is `HTTP_X_FORWARDED_PATH` (the computed value of `X-Forwarded-Path`)

Trusted Proxies
---------------

[](#trusted-proxies)

This package also has the ability to allow only certain proxy servers to modify the necessary values in order to set the proper absolute URL.

By default, all proxy servers are allowed to modify the values; if, however, the following value is set in your .env file then you can create a whitelist of proxies:

### TRUSTED\_PROXIES

[](#trusted_proxies)

This is a comma-delimited list of hostnames/IP addresses that are allowed to perform proxying functions.

```
TRUSTED_PROXIES=192.168.1.10,www.example.com,192.168.3.12

```

The above example would allow the following three proxy servers to provide proxying functionality:

- 192.168.1.10 (would come from the `REMOTE_ADDR` value in PHP)
- [www.example.com](http://www.example.com) (would come from the `X-Forwarded-Server` header from the web server)
- 192.168.3.12 (would come from the `REMOTE_ADDR` value in PHP)

Usage Example
-------------

[](#usage-example)

Let's say you have an application hosted at `http://laravel.example.com` but that is not the location you want to show to the world. Instead, you want to show a URL of `http://www.example.com/laravel` so you place your Laravel application behind a proxy.

However, you notice that while the front page loads properly, none of the URLs you have written with the `url()`, `asset()`, or other helpers work with that URL and instead continue writing `http://laravel.example.com` as their base path.

You can configure your proxy to add a request header along with your `ProxyPass` and `ProxyPassReverse` directives in Apache (ensure you have `mod_headers` enabled and `mod_proxy` enabled as well):

```
ProxyPass        /laravel http://laravel.example.com
ProxyPassReverse /laravel http://laravel.example.com

RequestHeader set X-Forwarded-Path "http://www.example.com/laravel"

```

Now all of your URLs using the `url()`, `asset()`, and other helpers will be written correctly!

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~68 days

Recently: every ~86 days

Total

6

Last Release

3113d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef2f088dbe515e7505204053ba4b89fab631db23d7638297853dc697adf7ddc4?d=identicon)[matthewfritz](/maintainers/matthewfritz)

![](https://www.gravatar.com/avatar/5c86fd91fdf698dd5c9ceffd3dce175a6ae3000d00f4c00bf65b2e97f19072a1?d=identicon)[csun-metalab](/maintainers/csun-metalab)

![](https://www.gravatar.com/avatar/eb2e4b7e97c47122102e9eca3a2707f31d812f27d774197f62f27f130d128e49?d=identicon)[luisjg](/maintainers/luisjg)

---

Top Contributors

[![matthewfritz](https://avatars.githubusercontent.com/u/1715181?v=4)](https://github.com/matthewfritz "matthewfritz (24 commits)")

### Embed Badge

![Health badge](/badges/csun-metalab-laravel-proxypass/health.svg)

```
[![Health](https://phpackages.com/badges/csun-metalab-laravel-proxypass/health.svg)](https://phpackages.com/packages/csun-metalab-laravel-proxypass)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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