fix: resolve frontend API routing issues for Traefik deployment
Test and Lint / backend-test (push) Successful in 1m16s
continuous-integration/drone/push Build is failing
Test and Lint / frontend-test (push) Successful in 2m18s
Version and Release / version-bump (push) Successful in 43s
Version and Release / trigger-drone (push) Successful in 4s

Major fixes for production deployment with Traefik:

1. API Path Fixes:
   - Remove double /api prefix from all frontend service calls
   - Fix auth.service.ts to use correct paths (/auth/admin/login)
   - Update all services to use single /api prefix from base URL
   - Fix template literal paths in photo services

2. Docker Configuration:
   - Add build args for VITE_API_URL in docker-compose.prod.yml
   - Create Dockerfile.prod with proper API URL configuration
   - Ensure frontend is built with correct API base path

3. Documentation:
   - Add comprehensive TRAEFIK_DEPLOYMENT.md guide
   - Document proper Traefik labels and routing configuration
   - Include troubleshooting steps for common issues
   - Explain network configuration and SSL handling

This resolves:
- 502 Bad Gateway errors
- Double /api/api paths in requests
- Frontend unable to communicate with backend
- Login functionality not working

The frontend now correctly calls the backend API through Traefik's
routing, with all requests going to /api/* being forwarded to the
backend service on port 3000.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-13 23:17:45 +02:00
parent 689861f671
commit ac1cd96ecd
25 changed files with 422 additions and 75 deletions
+5 -5
View File
@@ -46,7 +46,7 @@ export interface ArchivesResponse {
export const archiveService = {
// Get all archives with pagination
async getArchives(page: number = 1, limit: number = 20): Promise<ArchivesResponse> {
const response = await api.get<ArchivesResponse>('/api/admin/archives', {
const response = await api.get<ArchivesResponse>('/admin/archives', {
params: { page, limit }
});
return response.data;
@@ -54,18 +54,18 @@ export const archiveService = {
// Get single archive details
async getArchiveDetails(id: number): Promise<ArchiveDetails> {
const response = await api.get<ArchiveDetails>(`/api/admin/archives/${id}`);
const response = await api.get<ArchiveDetails>(`/admin/archives/${id}`);
return response.data;
},
// Restore archive
async restoreArchive(id: number): Promise<void> {
await api.post(`/api/admin/archives/${id}/restore`);
await api.post(`/admin/archives/${id}/restore`);
},
// Download archive
async downloadArchive(id: number, filename: string): Promise<void> {
const response = await api.get(`/api/admin/archives/${id}/download`, {
const response = await api.get(`/admin/archives/${id}/download`, {
responseType: 'blob'
});
@@ -82,7 +82,7 @@ export const archiveService = {
// Delete archive permanently
async deleteArchive(id: number): Promise<void> {
await api.delete(`/api/admin/archives/${id}`);
await api.delete(`/admin/archives/${id}`);
},
// Format bytes to human readable