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
7 changes: 5 additions & 2 deletions config/templates/app/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ http {

access_log /dev/stdout main;

location {{ env.FRONTEND_BASE_URL }}api {
absolute_redirect off;


location {{ env.FRONTEND_BASE_URL }}api/ {
include /etc/nginx/uwsgi_params;
uwsgi_pass backend;

Expand All @@ -66,7 +69,7 @@ http {

{% if env.FRONTEND_BASE_URL != '/' -%}
location / {
return 301 {{ env.FRONTEND_BASE_URL }};
return 301 {{ env.FRONTEND_BASE_URL[:-1] }}$request_uri;
}
{%- endif %}
}
Expand Down
9 changes: 8 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ JINJA2="import os, sys, jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read(

ALERTA_CONF_FILE=${ALERTA_CONF_FILE:-/app/alerta.conf}
ALERTA_SVR_CONF_FILE=${ALERTA_SVR_CONF_FILE:-/app/alertad.conf}
ALERTA_WEB_CONF_FILE=/web${FRONTEND_BASE_URL}config.json
NGINX_CONF_FILE=/app/nginx.conf
UWSGI_CONF_FILE=/app/uwsgi.ini
SUPERVISORD_CONF_FILE=/app/supervisord.conf
Expand All @@ -17,6 +16,14 @@ ADMIN_USER=${ADMIN_USERS%%,*}
ADMIN_PASSWORD=${ADMIN_PASSWORD:-alerta}
MAXAGE=${ADMIN_KEY_MAXAGE:-315360000} # default=10 years

# Make sure that FRONTEND_BASE_URL ends with a /
if [[ "${FRONTEND_BASE_URL: -1}" != "/" ]]; then
if [ $INIT_LOG = true ]; then echo "# Fixed FRONTEND_BASE_URL by adding a '/' at the end"; fi
export FRONTEND_BASE_URL=${FRONTEND_BASE_URL}/
fi

ALERTA_WEB_CONF_FILE=/web${FRONTEND_BASE_URL}config.json

# Generate minimal server config, if not supplied
if [ ! -f "${ALERTA_SVR_CONF_FILE}" ]; then
if [ $INIT_LOG = true ]; then echo "# Create server configuration file."; fi
Expand Down
Loading