Skip to content
Open
Show file tree
Hide file tree
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
44 changes: 44 additions & 0 deletions functions/_middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// functions/_middleware.ts
export async function onRequest(context: {
request: Request;
next: () => Promise<Response>;
}) {
const response = await context.next();

// إضافة Headers للأمان
const newHeaders = new Headers(response.headers);
newHeaders.set('X-Frame-Options', 'DENY');
newHeaders.set('X-Content-Type-Options', 'nosniff');
newHeaders.set('Referrer-Policy', 'strict-origin-when-cross-origin');

return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
```

---

### 5️⃣ تأكد من وجود `public/_redirects`
```
# public/_redirects
/* /index.html 200
```

---

### 6️⃣ هيكل المشروع النهائي
```
vue-tailwind-admin-dashboard/
├── public/
│ ├── _redirects ← مهم للـ SPA
│ └── index.html
├── src/
├── functions/ ← اختياري
│ └── _middleware.ts
├── wrangler.toml ← أضفه بالتاريخ الصحيح
├── package.json
├── vite.config.ts
└── tsconfig.json
Loading