- introduce storage.Backend with S3 and local file-system implementations - deliver all blobs via signed GET/HEAD /api/objects/<key> (Range, Content-Type) - stream S3 objects through the backend; remove presigned URL path - share shared HMAC Signer between backends - remove S3_PUBLIC_URL; rename S3_PRESIGN_TTL to OBJECT_URL_TTL - make storage label in health dynamic; nginx proxy_buffering off for objects
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
# Пример nginx-конфигурации перед Go-бэкендом.
|
|
# Для SSE критично proxy_buffering off, иначе события буферизуются и не доходят.
|
|
|
|
upstream shared_album {
|
|
server 127.0.0.1:8080;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name album.example.com;
|
|
|
|
client_max_body_size 60m;
|
|
|
|
location /api/sse/ {
|
|
proxy_pass http://shared_album;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_buffering off; # иначе SSE буферизуется
|
|
proxy_cache off;
|
|
proxy_read_timeout 1h;
|
|
chunked_transfer_encoding on;
|
|
}
|
|
|
|
location /api/objects/ {
|
|
proxy_pass http://shared_album;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_buffering off; # стриминг объектов без буферизации
|
|
proxy_cache off;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://shared_album;
|
|
proxy_http_version 1.1;
|
|
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;
|
|
}
|
|
}
|