Skip to content

Commit

Permalink
TrustProxiesを書き換えない
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Feb 18, 2024
1 parent 4ad9471 commit 4e17c9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 17 additions & 0 deletions docs/vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 13,23 @@ https://github.com/kawax/self-ordering-starter

変更するとしたら`vercel.json``APP_NAME`

## TrustProxiesの設定
Laravel10とLaravel11以降で設定方法が違うので手動で変更が必要。

### Laravel 10
`/app/Http/Middleware/TrustProxies.php`を変更。
```php
protected $proxies = '*';
```

### Laravel 11
`/bootstrap/app.php`を変更。
```php
->withMiddleware(function (Middleware $middleware) {
$middleware->trustProxies('*');
})
```

## installコマンド以外での必須ではない変更箇所
composer.jsonの`scripts`。ここを参考に。
https://github.com/kawax/self-ordering-starter/blob/master/composer.json
Expand Down
4 changes: 0 additions & 4 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 58,6 @@ public function handle(): int
copy(__DIR__.'/../../stubs/.vercelignore', base_path('.vercelignore'));
copy(__DIR__.'/../../stubs/vercel.json', base_path('vercel.json'));

if ((new Filesystem())->exists($path = app_path('Http/Middleware/TrustProxies.php'))) {
$this->replaceInFile('$proxies;', '$proxies = \'*\';', $path); // @codeCoverageIgnore
}

$this->info('Ordering scaffolding installed successfully.');
$this->comment('Please execute the "npm install && npm run build" command to build your assets.');

Expand Down

0 comments on commit 4e17c9e

Please sign in to comment.