Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ services:
timeout: 1s
retries: 3
start_period: 60s
start_interval: 30s
start_interval: 5s
expose:
- 9002
volumes:
Expand Down
7 changes: 7 additions & 0 deletions nginx/files/01-listen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ if [ -f "/etc/nginx/certs/cert.pem" ] && [ -f "/etc/nginx/certs/key.pem" ]; then
exit 1
;;
esac
else
case "$BASE_URL" in
https://*)
echo "BASE_URL starts with https://, but SSL certificate is NOT present. Please update your env variables!"
exit 1
;;
esac
fi

if [ -f "/etc/nginx/certs/cert.pem" ] && [ -f "/etc/nginx/certs/key.pem" ]; then
Expand Down
13 changes: 5 additions & 8 deletions nginx/files/04-ssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ if [ ! -f "/etc/nginx/certs/cert.pem" ] || [ ! -f "/etc/nginx/certs/key.pem" ];
exit 0
fi

# normalize redirect url
REDIRECT_URL=${BASE_URL#http://}
REDIRECT_URL=${REDIRECT_URL#https://}
REDIRECT_URL="https://${REDIRECT_URL}"

# build redirect config
cat >> "$REDIRECT_CONF" <<EOF
# build redirect config if the BASE_URL is set
if [ -n "$BASE_URL" ]; then
cat >> "$REDIRECT_CONF" <<EOF
server {
server_name misp;
listen ${NGINX_INTERNAL_HTTP_PORT};
Expand All @@ -29,9 +25,10 @@ server {
server_tokens off;

# redirect all traffic to HTTPS
return 301 ${REDIRECT_URL};
return 301 ${BASE_URL};
}
EOF
fi

# build ssl block
cat >> "$SSL_CONF" <<EOF
Expand Down