diff options
author | ben | 2025-02-01 13:54:25 +0100 |
---|---|---|
committer | ben | 2025-02-01 13:54:25 +0100 |
commit | cf09067c156b581db6cde07728cce849b7a971e3 (patch) | |
tree | ee75be9ba6bffc4f923b87c327c6b401f5634037 /src/nginx/nginx.conf | |
parent | 01f224002e91e9ba8c567dbfb20a364f13327842 (diff) | |
download | ai_env-cf09067c156b581db6cde07728cce849b7a971e3.tar.gz ai_env-cf09067c156b581db6cde07728cce849b7a971e3.tar.bz2 ai_env-cf09067c156b581db6cde07728cce849b7a971e3.tar.xz |
Expose OpenAI API compatibility using aichat
Diffstat (limited to 'src/nginx/nginx.conf')
-rw-r--r-- | src/nginx/nginx.conf | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nginx/nginx.conf b/src/nginx/nginx.conf index 2dc6d52..5e411a9 100644 --- a/src/nginx/nginx.conf +++ b/src/nginx/nginx.conf @@ -58,4 +58,21 @@ http { proxy_set_header Connection "upgrade"; } } + server { + listen 8002; + set $deny 1; + if ($http_authorization = "Bearer $API_KEY") { + set $deny 0; + } + if ($deny) { + return 403; + } + location / { + proxy_pass http://aichat:8000; + 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; + } + } } |