fix: Mixed Content hatası - API_URL boş string yapıldı + categories proxy eklendi

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 <noreply@anthropic.com>
This commit is contained in:
furkanyigit34
2026-03-31 00:19:13 +03:00
parent 5d976b26f4
commit 1aa626d4b3
2 changed files with 21 additions and 1 deletions

View File

@@ -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;

View File

@@ -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 = {