Investigate CORS proxy failure

The CORS proxy is failing despite being enabled, resulting in REST API and database connection errors. Investigate the cause of the failure.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 12:23:00 +00:00
parent 893e1cf0aa
commit 1623fd7738
4 changed files with 68 additions and 16 deletions

View File

@@ -6,9 +6,10 @@ export const getSupabaseUrl = () => {
if (storedUrl) {
// CORS 프록시 설정 확인
const useProxy = localStorage.getItem('use_cors_proxy') === 'true';
if (useProxy && storedUrl.startsWith('http://')) {
// CORS 프록시 URL로 변환
return `https://corsproxy.io/?${encodeURIComponent(storedUrl)}`;
if (useProxy) {
// CORS 프록시 URL로 변환 (URL 구조 개선)
const cleanUrl = storedUrl.trim();
return `https://corsproxy.io/?${encodeURIComponent(cleanUrl)}`;
}
return storedUrl;
}
@@ -39,8 +40,11 @@ export const isCorsProxyEnabled = () => {
// 온프레미스 연결을 위한 설정 도우미 함수
export const configureSupabase = (url: string, key: string, useProxy: boolean = false) => {
// URL 정리 (앞뒤 공백 제거)
const cleanUrl = url.trim();
// 로컬 스토리지에 설정 저장
localStorage.setItem('supabase_url', url);
localStorage.setItem('supabase_url', cleanUrl);
localStorage.setItem('supabase_key', key);
localStorage.setItem('use_cors_proxy', useProxy.toString());