Skip to content

Commit

Permalink
Prevent nginx from crashing if IPv8 is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
n9iels committed Jun 8, 2020
1 parent b09fa81 commit 874ffb7
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions clerk-frontend/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ events {
worker_connections 1024;
}


http {
map $http_upgrade $connection_upgrade {
default upgrade;
Expand All @@ -26,16 +25,24 @@ http {
ssl_certificate /etc/nginx/certs/org.crt;
ssl_certificate_key /etc/nginx/certs/org.key;

location /api/ipv8/site/ {
proxy_pass http://ipv8:14410/;
# IP address of the Docker DNS resolver. Required for the '$ipv8_upstream' variables
resolver 127.0.0.11;

location ~ ^/api/ipv8/site/?(.*) {
# The usage of a variables prevents nginx from crashing when the upstream is not found,
# This is the case when IPv8 attestation is disabled
set $ipv8_upstream http://ipv8:14410/$1$is_args$args;
proxy_pass $ipv8_upstream;
}

location /api/ipv8/service/ {
proxy_pass http://ipv8:14411/;
location ~ ^/api/ipv8/service/?(.*) {
set $ipv8_upstream http://ipv8:14411/$1$is_args$args;
proxy_pass $ipv8_upstream;
}

location /api/ipv8/app/ {
proxy_pass http://ipv8:14412/;
location ~ ^/api/ipv8/app/?(.*) {
set $ipv8_upstream http://ipv8:14412/$1$is_args$args;
proxy_pass $ipv8_upstream;
}

location /api/eph/ {
Expand All @@ -48,6 +55,7 @@ http {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

location / {
root /usr/share/nginx/html;
include /etc/nginx/mime.types;
Expand Down

0 comments on commit 874ffb7

Please sign in to comment.