UPD nginx now redirects calls to codex api

This commit is contained in:
Shaun Orssaud 2023-11-02 16:07:01 +09:00
parent 34fc66b7d5
commit c72ad73aab
5 changed files with 44 additions and 29 deletions

View File

@ -12,5 +12,6 @@ RUN yarn build --production
FROM nginx:stable-alpine
COPY --from=build-step /frontend/build /usr/share/nginx/html
EXPOSE 80
COPY deployment/nginx.conf /etc/nginx/conf.d/.conf
COPY deployment/nginx.template /etc/nginx/nginx.template
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,21 +1,21 @@
events {}
http
server
{
server
{
listen 80;
server_name localhost;
listen 80;
server_name localhost;
location /api {
proxy_pass http://localhost:8080;
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;
}
location / {
try_files $uri /index.html;
add_header Cache-Control "no-cache";
}
root /usr/share/nginx/html;
index index.html;
error_page 500 502 503 504 /50x.html;
location /api {
proxy_pass $codex_url;
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;
}
location / {
try_files $uri /index.html;
add_header Cache-Control "no-cache";
}
}

21
deployment/nginx.template Normal file
View File

@ -0,0 +1,21 @@
server
{
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
error_page 500 502 503 504 /50x.html;
location /api {
proxy_pass $codex_url;
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;
}
location / {
try_files $uri /index.html;
add_header Cache-Control "no-cache";
}
}

View File

@ -7,13 +7,6 @@ services:
ports:
- "3000:80"
environment:
- CODEX=http://localhost:8080
nginx:
image: nginx:alpine
- codex_url=http://host.docker.internal:8080
volumes:
- ./deployment/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8070:80"
depends_on:
- client
- ./deployment/nginx.template:/etc/nginx/templates/10-variables.conf.template:ro

View File

@ -19,7 +19,7 @@ function DebugPage() {
useEffect(() => {
axios
.get(
`/api/api/codex/v1/debug/info`,
`/api/codex/v1/debug/info`,
{
headers:
(nodeInfo.auth && {