8000 update `PreventRegularBrowserAccess` middleware docs by gwleuverink · Pull Request #127 · NativePHP/nativephp.com · GitHub
[go: up one dir, main page]

Skip to content

update PreventRegularBrowserAccess middleware docs #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions resources/views/docs/desktop/1/digging-deeper/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Security
order: 400
---

# Security

When building desktop applications it's essential to take your application's security to the next level, both to
Expand Down Expand Up @@ -72,27 +73,11 @@ but you should do all you can to prevent unwanted attack vectors from being made

#### Prevent regular browser access

When you're ready, you should add the `PreventRegularBrowserAccess` middleware to your application's global middleware
stack, **especially before building your application for production release**.

**This is NOT done for you.**
When you are running a build, the global `PreventRegularBrowserAccess` middleware will be applied to all your routes automatically.

This ensures that only requests coming from the web view shell that booted your application can make requests into your
application.

Append the middleware in your `bootstrap/app.php` file:

```php
use Native\Laravel\Http\Middleware\PreventRegularBrowserAccess;

return Application::configure(basePath: dirname(__DIR__))
// ...
->withMiddleware(function (Middleware $middleware) {
$middleware->append(PreventRegularBrowserAccess::class);
})
// ...
```

## Protecting your users and their data

Equally important is how your app protects users. NativePHP is a complex combination of powerful software and so there
Expand Down
0