From 1aa626d4b3c07ae9b870b690d46bbb5619338db1 Mon Sep 17 00:00:00 2001 From: furkanyigit34 <134547018+furkanyigit34@users.noreply.github.com> Date: Tue, 31 Mar 2026 00:19:13 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20Mixed=20Content=20hatas=C4=B1=20-=20API?= =?UTF-8?q?=5FURL=20bo=C5=9F=20string=20yap=C4=B1ld=C4=B1=20+=20categories?= =?UTF-8?q?=20proxy=20eklendi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ne yaptık: - admin-panel/src/config/api.js: API_URL default 'http://127.0.0.1:8001' → '' (boş string) - admin-panel/nginx.conf: /categories/ route için backend proxy location bloğu eklendi Neden yaptık: - HTTPS sitesinden (sslip.io) http://127.0.0.1:8001'e istek Mixed Content hatasına yol açıyordu - Boş string ile relative URL kullanılıyor, nginx /api/ ve /categories/ isteklerini backend'e proxy'liyor - CategoryManagement.jsx /categories/ prefix'li URL kullandığından nginx'te ayrı proxy bloğu gerekiyordu Co-Authored-By: Claude Sonnet 4.6 --- admin-panel/nginx.conf | 20 ++++++++++++++++++++ admin-panel/src/config/api.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/admin-panel/nginx.conf b/admin-panel/nginx.conf index 8c9a4d7..428ea70 100644 --- a/admin-panel/nginx.conf +++ b/admin-panel/nginx.conf @@ -23,12 +23,16 @@ server { application/javascript application/json application/xml image/svg+xml; + # Backend proxy shared settings (used by /api/ and /categories/) # API proxy to backend service # All requests to /api/* are proxied to the backend container location /api/ { proxy_pass http://backend:8001; proxy_http_version 1.1; + # Internal API key for backend authentication + proxy_set_header X-API-Key changeme; + # Preserve original request information proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -45,6 +49,22 @@ server { proxy_request_buffering off; } + # Categories API proxy (used by CategoryManagement) + location /categories/ { + proxy_pass http://backend:8001; + proxy_http_version 1.1; + + proxy_set_header X-API-Key changeme; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_connect_timeout 60s; + proxy_send_timeout 120s; + proxy_read_timeout 120s; + } + # Static assets caching (JS, CSS, images, fonts) location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; diff --git a/admin-panel/src/config/api.js b/admin-panel/src/config/api.js index 4920ec8..bb5601e 100644 --- a/admin-panel/src/config/api.js +++ b/admin-panel/src/config/api.js @@ -4,7 +4,7 @@ */ // API Base URL from environment or default -export const API_URL = import.meta.env.VITE_API_URL ?? 'http://127.0.0.1:8001' +export const API_URL = import.meta.env.VITE_API_URL ?? '' // Timeout configurations (in milliseconds) export const TIMEOUT_CONFIG = {