mirror of
https://github.com/vndangkhoa/Sys-Arc-Visl.git
synced 2026-04-04 17:08:17 +07:00
fix: allow docker container to start without ollama dependency
This commit is contained in:
parent
e52f9e5e51
commit
5ada3b1fcd
1 changed files with 11 additions and 2 deletions
13
nginx.conf
13
nginx.conf
|
|
@ -12,15 +12,24 @@ server {
|
|||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Proxy Ollama API requests
|
||||
# Proxy Ollama API requests (optional - only works when ollama container is running)
|
||||
# This solves Mixed Content (HTTPS -> HTTP) and CORS issues
|
||||
location /api/ {
|
||||
proxy_pass http://ollama:11434/api/;
|
||||
# Use Docker's internal DNS resolver with short timeout
|
||||
# This allows nginx to start even if ollama is not running
|
||||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||
set $ollama_upstream "ollama:11434";
|
||||
proxy_pass http://$ollama_upstream/api/;
|
||||
|
||||
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;
|
||||
|
||||
# Timeout settings for when ollama is unavailable
|
||||
proxy_connect_timeout 5s;
|
||||
proxy_read_timeout 300s;
|
||||
|
||||
# CORS headers (redundant if OLLAMA_ORIGINS is set, but good for safety)
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
|
|
|
|||
Loading…
Reference in a new issue