fix: forward headers during requests where needed

this is mainly just so any ip headers like cf-connecting-ip are forwarded for rate limiting
This commit is contained in:
2026-03-31 02:18:52 -04:00
parent 6d99a06c17
commit 3b53cfbddf
6 changed files with 34 additions and 20 deletions
@@ -3,9 +3,10 @@ import type { Paste } from '$lib/types/paste';
import { extractError } from '$lib/utils/misc';
import { error } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ fetch }) => {
export const load: PageServerLoad = async ({ fetch, request }) => {
try {
const res = await fetch('/api/paste/recent');
const headers = new Headers(request.headers);
const res = await fetch('/api/paste/recent', { headers });
if (!res.ok) {
const errorMsg = extractError(await res.json()) || 'Failed to fetch recent pastes.';
throw error(res.status, errorMsg);