Update CORS proxy configuration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { getProxyType, isCorsProxyEnabled } from '@/lib/supabase/config';
|
||||
|
||||
/**
|
||||
* CORS 문제 확인
|
||||
@@ -37,6 +38,11 @@ export const verifyServerConnection = async (): Promise<{
|
||||
};
|
||||
}
|
||||
|
||||
// 프록시 설정 상태 확인
|
||||
const usingProxy = isCorsProxyEnabled();
|
||||
const proxyType = getProxyType();
|
||||
console.log(`연결 테스트 - CORS 프록시: ${usingProxy ? '사용 중' : '미사용'}, 타입: ${proxyType}`);
|
||||
|
||||
// 단순 헬스 체크 요청
|
||||
try {
|
||||
const response = await fetch(`${supabaseUrl}/auth/v1/`, {
|
||||
@@ -92,6 +98,10 @@ export const verifyServerConnection = async (): Promise<{
|
||||
} catch (error: any) {
|
||||
console.error('서버 연결 확인 중 오류:', error);
|
||||
|
||||
// 프록시 설정 확인
|
||||
const usingProxy = isCorsProxyEnabled();
|
||||
const proxyType = getProxyType();
|
||||
|
||||
// 오류 유형에 따른 메시지 설정
|
||||
let errorMessage = '알 수 없는 네트워크 오류';
|
||||
|
||||
@@ -111,6 +121,15 @@ export const verifyServerConnection = async (): Promise<{
|
||||
}
|
||||
}
|
||||
|
||||
// Cloudflare 프록시 추천 메시지 추가
|
||||
if (errorMessage.includes('CORS') || errorMessage.includes('fetch') || errorMessage.includes('네트워크')) {
|
||||
if (!usingProxy) {
|
||||
console.log('CORS 오류 감지, Cloudflare 프록시 사용 권장');
|
||||
} else if (proxyType !== 'cloudflare') {
|
||||
console.log('CORS 오류 감지, Cloudflare 프록시로 변경 권장');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
connected: false,
|
||||
message: errorMessage
|
||||
|
||||
Reference in New Issue
Block a user