chore(env): update production environment variables and enhance proxy handling in Nginx configuration
This commit is contained in:
@@ -2,7 +2,7 @@ APP_NAME=Hoshpoint
|
|||||||
APP_ENV=production
|
APP_ENV=production
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=false
|
APP_DEBUG=false
|
||||||
APP_URL=https://example.com
|
APP_URL=https://hoshpoint-api.treenix.ir
|
||||||
HTTP_PORT=8080
|
HTTP_PORT=8080
|
||||||
|
|
||||||
APP_LOCALE=fa
|
APP_LOCALE=fa
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\Policies\UserPolicy;
|
|||||||
use App\Policies\WalletPolicy;
|
use App\Policies\WalletPolicy;
|
||||||
use App\Policies\WalletTransactionPolicy;
|
use App\Policies\WalletTransactionPolicy;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Support\Facades\URL;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
@@ -31,6 +32,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
|
if (app()->environment('production') || str_starts_with((string) config('app.url'), 'https://')) {
|
||||||
|
URL::forceScheme('https');
|
||||||
|
}
|
||||||
|
|
||||||
User::observe(UserObserver::class);
|
User::observe(UserObserver::class);
|
||||||
|
|
||||||
Gate::policy(User::class, UserPolicy::class);
|
Gate::policy(User::class, UserPolicy::class);
|
||||||
|
|||||||
@@ -13,7 +13,14 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
health: '/up',
|
health: '/up',
|
||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware): void {
|
->withMiddleware(function (Middleware $middleware): void {
|
||||||
//
|
$middleware->trustProxies(
|
||||||
|
at: '*',
|
||||||
|
headers: Request::HEADER_X_FORWARDED_FOR
|
||||||
|
| Request::HEADER_X_FORWARDED_HOST
|
||||||
|
| Request::HEADER_X_FORWARDED_PORT
|
||||||
|
| Request::HEADER_X_FORWARDED_PROTO
|
||||||
|
| Request::HEADER_X_FORWARDED_AWS_ELB,
|
||||||
|
);
|
||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions): void {
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
$exceptions->shouldRenderJsonWhen(
|
$exceptions->shouldRenderJsonWhen(
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ return [
|
|||||||
* Edit to trust the proxy's ip address - needed for AWS Load Balancer
|
* Edit to trust the proxy's ip address - needed for AWS Load Balancer
|
||||||
* string[]
|
* string[]
|
||||||
*/
|
*/
|
||||||
'proxy' => false,
|
'proxy' => env('L5_SWAGGER_BEHIND_PROXY', '*'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle.
|
* Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle.
|
||||||
@@ -315,7 +315,7 @@ return [
|
|||||||
* Constants which can be used in annotations
|
* Constants which can be used in annotations
|
||||||
*/
|
*/
|
||||||
'constants' => [
|
'constants' => [
|
||||||
'L5_SWAGGER_CONST_HOST' => env('L5_SWAGGER_CONST_HOST', 'http://my-default-host.com'),
|
'L5_SWAGGER_CONST_HOST' => env('L5_SWAGGER_CONST_HOST', env('APP_URL', 'http://localhost')),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ server {
|
|||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto;
|
||||||
|
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||||||
|
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_hide_header X-Powered-By;
|
fastcgi_hide_header X-Powered-By;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user