diff --git a/Dockerfile b/Dockerfile index 58fc8b792623052baeb9505dee44c631d9f9e178..f78500773c0324b6f70d53e0c5eef6164eed47da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY nginx/start.sh /start.sh COPY src src -COPY dist /usr/share/nginx/html +COPY dist /usr/share/nginx/html/app ARG fdp_app ENV APP=$fdp_app diff --git a/nginx/default.conf b/nginx/default.conf index 7b917704a6356290b663a4c7cf1fd6ffd62533e8..a462351c3fb7189ac99a8a5be7b74751e16062d4 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -1,5 +1,5 @@ upstream fdp-api { - server 10.3.148.245; + server 146.59.2.80; } server { @@ -10,42 +10,45 @@ server { location / { - set $should_proxy 1; - - # Client html - if ($http_accept ~ '(text/html)') { - set $should_proxy 0; - } - - # Client assets - if ($request_uri ~ '(\.css)|(\.png)|(\.js)|(\.ico)$') { - set $should_proxy 0; - } - - # RDF API - if ($request_uri ~ '(\?format=(.+))$') { - set $should_proxy 1; - } - - # Swagger - if ($request_uri ~ '(swagger-ui\.html)') { - set $should_proxy 1; - } - - # Swagger assets - if ($request_uri ~ '^(/webjars)') { - set $should_proxy 1; - } - - if ($should_proxy) { - proxy_pass http://fdp-api; - break; - } - - root /usr/share/nginx/html; - add_header Last-Modified ""; - index index.html index.htm; - } + + + set $should_proxy 1; + + + # Client html + if ($http_accept ~ '(text/html)') { + set $should_proxy 0; + } + + # Client assets + if ($request_uri ~ '(\.css)|(\.png)|(\.js)|(\.ico)$') { + set $should_proxy 0; + } + + # RDF API + if ($request_uri ~ '(\?format=(.+))$') { + set $should_proxy 1; + } + + # Swagger + if ($request_uri ~ '^(/swagger-ui\.html)|(/swagger-ui/)|(/v3/api-docs)') { + set $should_proxy 1; + } + + # Swagger assets + if ($request_uri ~ '^(/webjars)') { + set $should_proxy 1; + } + + if ($should_proxy) { + proxy_pass http://fdp-api; + break; + } + + root /usr/share/nginx/html; + add_header Last-Modified ""; + index index.html index.htm; + } error_page 500 502 503 504 /50x.html; location = /50x.html { diff --git a/nginx/start.sh b/nginx/start.sh index 9d581582ff957ffa221dee5ef2c117aa3930f129..0742aafe4d6cbaf14957ba0f4fb621b1acfbd0eb 100755 --- a/nginx/start.sh +++ b/nginx/start.sh @@ -5,5 +5,4 @@ #sed -i "s#\$FDP_API_SERVICE_HOST#"$FDP_API_SERVICE_HOST"#g" /usr/share/nginx/html/config.js #sed -i "s#\$FDP_API_SERVICE_HOST#"$FDP_API_SERVICE_HOST"#g" /usr/share/nginx/html/app/config.js - nginx -g 'daemon off;' diff --git a/public/config.js b/public/config.js index 5a390e664f097a0a5a1837ae1e5c9ece90a05226..aa71feec16fecee9e6fefc846ee3b30e1c2813b8 100644 --- a/public/config.js +++ b/public/config.js @@ -1,4 +1,5 @@ window.config = { publicPath: '', - apiURL: 'http://fdp-api.f2ds.svc.cluster.local/' + apiURL: 'http://146.59.2.80' } +