Skip to content

Commit

Permalink
OZ-457: Fixed issue with Nginx crashing when running the SENAITE serv…
Browse files Browse the repository at this point in the history
…ice locally (#75)
  • Loading branch information
Ruhanga authored Feb 1, 2024
1 parent 1ade169 commit 1edd1f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
20 changes: 7 additions & 13 deletions proxy/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ map $forwarded_proto $var_proxy_cookie_flags {
default "off";
}

map $GITPOD_ENV $senaite_rewrite {
"true" /VirtualHostBase/https/$host/senaite/VirtualHostRoot/;
default /VirtualHostBase/http/$host/senaite/VirtualHostRoot/;
}

upstream frontend {
# always assume the frontend will be available
server frontend max_fails=0;
Expand Down Expand Up @@ -159,18 +164,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $senaite senaite:8080;
proxy_pass http://$senaite;
rewrite ^(.*)$ /VirtualHostBase/https/$host/senaite/VirtualHostRoot/$1 break;
}
}

server {
listen 8081;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set $senaite senaite:8080;
proxy_pass http://$senaite;
rewrite ^(.*)$ /VirtualHostBase/http/$host/senaite/VirtualHostRoot/$1 break;
rewrite ^(.*)$ $senaite_rewrite/$1 break;
}
}
}
3 changes: 3 additions & 0 deletions proxy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ services:

# Nginx - Entry point for the application.
proxy:
environment:
- GITPOD_ENV=${GITPOD_ENV}

restart: unless-stopped
build:
context: ./
Expand Down
4 changes: 3 additions & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ INSTALLED_DOCKER_VERSION=$(docker version -f "{{.Server.Version}}")
MINIMUM_REQUIRED_DOCKER_VERSION_REGEX="^((([2-9][1-9]|[3-9][0]|[0-9]{3,}).*)|(20\.([0-9]{3,}|[1-9][1-9]|[2-9][0]).*)|(20\.10\.([0-9]{3,}|[2-9][0-9]|[1][3-9])))"
if [[ $INSTALLED_DOCKER_VERSION =~ $MINIMUM_REQUIRED_DOCKER_VERSION_REGEX ]]; then
if command -v gp version &> /dev/null; then
export PROXY_TLS="-DgitPodEnvironment"
export GITPOD_ENV="true"
else
export GITPOD_ENV="false"
fi

# Pull Ozone Docker images
Expand Down

0 comments on commit 1edd1f1

Please sign in to comment.