PHPackages                             peppeocchi/laravel-elb-middleware - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. peppeocchi/laravel-elb-middleware

ActiveMiddleware[Utility &amp; Helpers](/categories/utility)

peppeocchi/laravel-elb-middleware
=================================

Laravel middleware for Elastic Beanstalk

v3.0(6y ago)144.4k11MITPHP

Since Aug 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/peppeocchi/laravel-elb-middleware)[ Packagist](https://packagist.org/packages/peppeocchi/laravel-elb-middleware)[ RSS](/packages/peppeocchi-laravel-elb-middleware/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

Elastic Beanstalk middleware for Laravel and HTTPS
==================================================

[](#elastic-beanstalk-middleware-for-laravel-and-https)

This middlware will ensure that your Laravel app will correctly recognise **secure** requests when running on Elastic Beanstalk with a Load Balancer. **NOTE:** make sure your web server is not publicly accessible and that the Load Balancer only have access (you can manage that through AWS security groups).

There is also a [gist](https://gist.github.com/peppeocchi/4f522663d7e88029daeba833c835df3d) that does the exact same thing.

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

[](#installation)

You can install this middleware through [Composer](https://getcomposer.org/)

```
composer require peppeocchi/laravel-elb-middleware

```

Usage
-----

[](#usage)

The simplest way to use the middleware is to add it as a global middleware in `app/Http/Kernel.php`

```
...
class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \GO\ElasticBeanstalkHttps::class
    ];
...
```

but you are free to add it to a middleware group or directly into your controllers.

### TL;DR

[](#tldr)

On Elastic Beanstalk (with a load balancer), all the requests are being "proxied" to port 80. The load balancer will add the `x-forwarded-*` headers to the request.

Laravel `Request` inherits from `Symfony\Component\HttpFoundation\Request`, so it already supports the `x-forwarded-*` headers, but it needs to be configured to look at those headers or you are going to get incorrect informations about the request (eg. `$request->isSecure()` will always return false).

The Amazon ELB don't have a static IP or a range to target, so you'll need to trust all proxies. Of course you need to make sure your web server will respond only to the [load balancer](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html).

#### Read also

[](#read-also)

[Symfony documentation](https://symfony.com/doc/current/request/load_balancer_reverse_proxy.html)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

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 ~528 days

Total

3

Last Release

2504d ago

Major Versions

v1.0 → v2.02017-06-06

v2.0 → v3.02019-07-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/533e46e754d1cf87f2c2830af012a838b4faeb0ac013d047c3858a99215d1a0a?d=identicon)[peppeocchi](/maintainers/peppeocchi)

---

Top Contributors

[![peppeocchi](https://avatars.githubusercontent.com/u/4161743?v=4)](https://github.com/peppeocchi "peppeocchi (7 commits)")

### Embed Badge

![Health badge](/badges/peppeocchi-laravel-elb-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/peppeocchi-laravel-elb-middleware/health.svg)](https://phpackages.com/packages/peppeocchi-laravel-elb-middleware)
```

###  Alternatives

[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[illuminate/cookie

The Illuminate Cookie package.

224.3M122](/packages/illuminate-cookie)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[codefog/contao-news_categories

News Categories bundle for Contao Open Source CMS

3183.3k6](/packages/codefog-contao-news-categories)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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