mamyraoby/laravel-proxy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mamyraoby/laravel-proxy

最新稳定版本:0.0.2

Composer 安装命令:

composer require mamyraoby/laravel-proxy

包简介

Better support reverse proxy Laravel deployement

README 文档

README

What are the use of this package?

  • Automated Configuration: The package automates the configuration process for Laravel apps deployed behind reverse proxy web servers. This is beneficial because it eliminates the need for repetitive manual configuration each time the app is deployed, saving time and reducing the potential for human error.

  • Asset Handling: One of the key issues it addresses is the incorrect serving of built and dynamic assets. Reverse proxies can sometimes cause issues with how assets are delivered to the client, and this package ensures that assets are served correctly without additional manual adjustments.

  • Quick Setup: By using this package, developers can quickly set up their Laravel application for deployment behind a reverse proxy, making the deployment process more efficient.

Installation

Add mamyraoby/laravel-proxy as depenceny of your project, by running the following command:

composer require mamyraoby/laravel-proxy

Then register this middleware into your application:

Laravel 11 and above

Open the bootstrap/app.php and add the following line inside the middlewares registration section:

$middleware->append([
    \MamyRaoby\LaravelProxy\Middleware\ProxyMiddleware::class,
]);

Laravel ancient version

Open the app/Http/Kernel.php and update the middleware attrubutes value by adding this line:

protected $middleware = [
    \MamyRaoby\LaravelProxy\Middleware\ProxyMiddleware::class,
];

You may set up these env variables into your .env file:

  • PROXY_SCHEME:

    Accepted value: http or https . Default to http if not set.

  • PROXY_URL:

    Accepted value: The base URL of the reverse proxy server. Example: https://example.com, make sure to include the port if you run from port different form 80 or 443. Default to APP_URL env value if not set.

  • PROXY_TRUSTED_IPS:

    A set of trusted proxies IP address, separated by comma.

    Example: PROXY_TRUSTED_IPS=172.1.0.0,192.168.1.1

    Default to * if not set, which means always trust everything.

    Unset this variable if your server has dynamic IP address or in case you don't know exactly the IP addresses for your server.

You should be good now, but if you need any further configuration or extension, you may publish the configuration file from the vendor, by running the following command:

php artisan vendor:publish mamyraoby-laravel-proxy-config

... and feel free to update your configuration.

Contribution

If you want to contribute or signal bugs, don't hesitate to open an issue or make a pull request, I also open to discuss, so email me at mamyraoby@outlook.com.

统计信息

  • 总下载量: 50
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-06-14