fix: 🐛 correctly identify cloudflare cache as requesting host for READ event

This commit is contained in:
Maxime Cannoodt 2022-08-09 12:43:38 +02:00
parent 0ba9d74a83
commit 75d6ae868f

View File

@ -2,9 +2,7 @@ import type { EncryptedNote } from '$lib/model/EncryptedNote';
import type { RequestHandler } from '@sveltejs/kit'; import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async ({ request, clientAddress, params }) => { export const get: RequestHandler = async ({ request, clientAddress, params }) => {
const ip = (request.headers.get('cd-connecting-ip') || const ip = (request.headers.get('x-forwarded-for') || clientAddress) as string;
request.headers.get('x-forwarded-for') ||
clientAddress) as string;
const url = `${import.meta.env.VITE_SERVER_INTERNAL}/api/note/${params.id}`; const url = `${import.meta.env.VITE_SERVER_INTERNAL}/api/note/${params.id}`;
const response = await fetch(url, { const response = await fetch(url, {
headers: { headers: {