Skip to content

Commit a0f248c

Browse files
authored
Merge pull request #40 from ryoluo/devin/1771739749-add-appserviceprovider-readme
docs: add AppServiceProvider update instructions to README
2 parents 5e5a66f + 52bfb29 commit a0f248c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@ php artisan sail-ssl:install
3131

3232
After containers started, you can access https://localhost.
3333

34+
## Update AppServiceProvider
35+
36+
Since the application is behind an Nginx reverse proxy that handles SSL, Laravel needs to be configured to generate HTTPS URLs. Add `URL::forceScheme('https')` to your `AppServiceProvider`:
37+
38+
```php
39+
<?php
40+
41+
namespace App\Providers;
42+
43+
use Illuminate\Support\ServiceProvider;
44+
45+
class AppServiceProvider extends ServiceProvider
46+
{
47+
/**
48+
* Register any application services.
49+
*/
50+
public function register(): void
51+
{
52+
//
53+
}
54+
55+
/**
56+
* Bootstrap any application services.
57+
*/
58+
public function boot(): void
59+
{
60+
\Illuminate\Support\Facades\URL::forceScheme('https');
61+
}
62+
}
63+
```
64+
65+
Without this setting, Laravel may generate HTTP URLs for assets, routes, etc., even though the site is served over HTTPS.
66+
3467
## Trust the certificate (optional)
3568

3669
The plugin generates a local Root CA certificate to sign the server certificate.

0 commit comments

Comments
 (0)