Changed to proxy
This commit is contained in:
@@ -2,8 +2,8 @@ services:
|
|||||||
backend:
|
backend:
|
||||||
image: git.out.jafre.li/jafreli/dashboard-backend:latest
|
image: git.out.jafre.li/jafreli/dashboard-backend:latest
|
||||||
container_name: dashboard-backend
|
container_name: dashboard-backend
|
||||||
ports:
|
# ports:
|
||||||
- "8080:8080"
|
# - "8080:8080"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/dashboard.db:/root/dashboard.db
|
- ./data/dashboard.db:/root/dashboard.db
|
||||||
|
|||||||
@@ -13,4 +13,17 @@ server {
|
|||||||
# This is the key for making client-side routing work.
|
# This is the key for making client-side routing work.
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add a new location block to proxy API requests
|
||||||
|
location /api/ {
|
||||||
|
# Forward the request to the backend service.
|
||||||
|
# The name 'backend' is resolved by Docker's internal DNS.
|
||||||
|
proxy_pass http://backend:8080;
|
||||||
|
|
||||||
|
# Set headers to pass along client information to the backend
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Item } from '../models/item';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
private apiUrl = 'http://localhost:8080/api/items';
|
private apiUrl = '/api/items';
|
||||||
|
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user