diff --git a/galaxy/502.html b/galaxy/502.html
new file mode 100644
index 000000000..3f286fa70
--- /dev/null
+++ b/galaxy/502.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+ Galaxy is down! | 502 - Webservice currently unavailable
+
+
+
+
+
+
+
Webservice currently unavailable Error 502
+
Most likely, the Galaxy is booting.
+Please don't panic. Relax, get some tea or ice-cream (depending on the season), and try again few seconds later.
+
+
+
+
+
+
diff --git a/galaxy/Dockerfile b/galaxy/Dockerfile
index 4b546c90b..e3f4e422d 100644
--- a/galaxy/Dockerfile
+++ b/galaxy/Dockerfile
@@ -131,6 +131,7 @@ RUN ansible-playbook /ansible/postgresql_provision.yml && \
--extra-vars supervisor_postgres_config_path=$PG_CONF_DIR_DEFAULT/postgresql.conf \
--extra-vars supervisor_postgres_autostart=false \
--extra-vars nginx_use_remote_header=True \
+ --extra-vars galaxy_errordocs_dest="/root/errors" \
--tags=galaxyextras -c local && \
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -192,6 +193,12 @@ RUN ./scripts/common_startup.sh && \
# Switch back to User root
USER root
+# Copy error pages and make the permissions right for NGINX to access them
+RUN mkdir /root/errors && mkdir /root/errors/502
+ADD ./502.html /root/errors/502/index.html
+RUN chmod o+x / && chmod o+x /root && chmod o+x /root/errors && chmod o+x /root/errors/502 && \
+ chmod o+x /root/errors/502/index.html
+
# Include all needed scripts from the host
ADD ./setup_postgresql.py /usr/local/bin/setup_postgresql.py
diff --git a/galaxy/roles/galaxyprojectdotorg.galaxyextras b/galaxy/roles/galaxyprojectdotorg.galaxyextras
index ef50faa6b..22fb714a5 160000
--- a/galaxy/roles/galaxyprojectdotorg.galaxyextras
+++ b/galaxy/roles/galaxyprojectdotorg.galaxyextras
@@ -1 +1 @@
-Subproject commit ef50faa6b820353571a8ce7bf85258ec74584ebc
+Subproject commit 22fb714a5a04f83f86c57d01bd13bb3db49e10b3