From eb248fb83e8cd2c99313018d4ecfabf8d6358c47 Mon Sep 17 00:00:00 2001 From: jkuensem <jkuensem@physik.uni-bielefeld.de> Date: Wed, 18 Dec 2019 15:09:46 +0100 Subject: [PATCH] LEI-40: Updated routing config for serving LSMR --- SAS/LSMR/docker/lsmr-testenv/lsmr_testenv_Dockerfile | 7 ++++--- SAS/LSMR/docker/lsmr-testenv/nginx.conf | 1 + SAS/LSMR/src/lsmr/settings.py | 5 +++++ SAS/LSMR/src/lsmr/urls.py | 10 ++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/SAS/LSMR/docker/lsmr-testenv/lsmr_testenv_Dockerfile b/SAS/LSMR/docker/lsmr-testenv/lsmr_testenv_Dockerfile index dde6329fc17..8db68fe2847 100644 --- a/SAS/LSMR/docker/lsmr-testenv/lsmr_testenv_Dockerfile +++ b/SAS/LSMR/docker/lsmr-testenv/lsmr_testenv_Dockerfile @@ -8,7 +8,8 @@ RUN yum -y groupinstall 'Development Tools' && \ yum -y install cmake log4cplus-devel python3 python3-devel python3-pip nodejs npm java && \ npm install -g npx && \ npm install -g n && \ - n stable + n stable && \ + npm install -g serve RUN echo "Installing packages for LSMR..." && \ yum -y install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm && \ @@ -60,5 +61,5 @@ ENTRYPOINT /bin/bash -c 'export VARIANT=gnucxx11_opt; \ lsmr_testdatabase & \ sleep 15 && \ lsmr & \ - cd /lofar/build/gnucxx11_opt/installed/share/www && \ - npm start' \ No newline at end of file + cd /lofar/build/gnucxx11_opt/SAS/LSMR/frontend/frontend_poc && \ + serve -s build -p 3000' \ No newline at end of file diff --git a/SAS/LSMR/docker/lsmr-testenv/nginx.conf b/SAS/LSMR/docker/lsmr-testenv/nginx.conf index c00bf984dbd..a2c8c49e643 100644 --- a/SAS/LSMR/docker/lsmr-testenv/nginx.conf +++ b/SAS/LSMR/docker/lsmr-testenv/nginx.conf @@ -10,6 +10,7 @@ http { proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Fprwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; proxy_pass_request_headers on; proxy_redirect off; diff --git a/SAS/LSMR/src/lsmr/settings.py b/SAS/LSMR/src/lsmr/settings.py index 1b6c34759e8..987e30c1aa2 100644 --- a/SAS/LSMR/src/lsmr/settings.py +++ b/SAS/LSMR/src/lsmr/settings.py @@ -213,3 +213,8 @@ USE_TZ = False # We don't want timezone support since everything is UTC anyway # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' + + +# Setup support for proxy headers +USE_X_FORWARDED_HOST = True +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') \ No newline at end of file diff --git a/SAS/LSMR/src/lsmr/urls.py b/SAS/LSMR/src/lsmr/urls.py index 339f3c18485..93ebe4c3034 100644 --- a/SAS/LSMR/src/lsmr/urls.py +++ b/SAS/LSMR/src/lsmr/urls.py @@ -16,6 +16,7 @@ Including another URLconf from django.contrib import admin from django.urls import path, re_path +from django.conf.urls import url, include from django.views.generic.base import TemplateView from rest_framework import routers, permissions @@ -44,11 +45,12 @@ swagger_schema_view = get_schema_view( ) urlpatterns = [ - path('api/admin/', admin.site.urls), - path('api/docs/', include_docs_urls(title='LSMR API')), + url(r'^', include('api.urls')), + path('admin/', admin.site.urls), + path('docs/', include_docs_urls(title='LSMR API')), re_path(r'^swagger(?P<format>\.json|\.yaml)$', swagger_schema_view.without_ui(cache_timeout=0), name='schema-json'), - path('api/swagger/', swagger_schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), - path('api/redoc/', swagger_schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), + path('swagger/', swagger_schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), + path('redoc/', swagger_schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), ] -- GitLab