feat: configure nginx proxy and response headers to support SSE for label print agent
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
This commit is contained in:
@@ -51,7 +51,8 @@ export class LabelPrintAgentController {
|
|||||||
|
|
||||||
// Agent: SSE-Stream für neue Druckaufträge
|
// Agent: SSE-Stream für neue Druckaufträge
|
||||||
@Sse('events')
|
@Sse('events')
|
||||||
sseEvents(): Observable<MessageEvent> {
|
sseEvents(@Res({ passthrough: true }) res: Response): Observable<MessageEvent> {
|
||||||
|
res.setHeader('X-Accel-Buffering', 'no');
|
||||||
return this.service.newJob$.pipe(
|
return this.service.newJob$.pipe(
|
||||||
map(() => ({ data: { type: 'label-job-available' } } as MessageEvent)),
|
map(() => ({ data: { type: 'label-job-available' } } as MessageEvent)),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,6 +4,21 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# ── SSE-Endpunkt (kein Puffern, langer Timeout) ────────────
|
||||||
|
location /api/label-print-agent/events {
|
||||||
|
proxy_pass http://backend:3100/api/label-print-agent/events;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection '';
|
||||||
|
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_buffering off;
|
||||||
|
proxy_cache off;
|
||||||
|
proxy_read_timeout 24h;
|
||||||
|
chunked_transfer_encoding on;
|
||||||
|
}
|
||||||
|
|
||||||
# ── API Reverse Proxy → Backend-Container ──────────────────
|
# ── API Reverse Proxy → Backend-Container ──────────────────
|
||||||
# Im Docker-Netzwerk ist "backend" der Service-Name aus docker-compose.
|
# Im Docker-Netzwerk ist "backend" der Service-Name aus docker-compose.
|
||||||
location /api/ {
|
location /api/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user