-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate nginx conf, add ubkg-api to DEV
- Loading branch information
Showing
5 changed files
with
102 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# HuBMAP ubkg-api | ||
# Port 6666 on host maps to 6666 on container | ||
server { | ||
# Only root can listen on ports below 1024, we use higher-numbered ports | ||
# since nginx is running under non-root user hubmap | ||
listen 6666; | ||
|
||
server_name localhost; | ||
root /usr/share/nginx/html; | ||
|
||
# Logging to the mounted volume for outside container access | ||
access_log /usr/src/app/log/nginx_access_hubmap-ubkg-api.log; | ||
error_log /usr/src/app/log/nginx_error_hubmap-ubkg-api.log warn; | ||
|
||
location / { | ||
# Always enable CORS | ||
# Response to preflight requests | ||
if ($request_method = 'OPTIONS') { | ||
# The directive `add_header` doesn't work when response status code is 401, 403 or 500 | ||
# The `always` parameter is specified so the header field will be added regardless of the response code | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always; | ||
|
||
# Custom headers and headers various browsers should be OK with but aren't | ||
add_header 'Access-Control-Allow-Headers' 'Authorization, Cache-Control, Content-Type' always; | ||
|
||
# Cache the response to this preflight request in browser for 24 hours (86400 seconds) | ||
# without sending another preflight request | ||
add_header 'Access-Control-Max-Age' 86400 always; | ||
|
||
add_header 'Content-Type' 'text/plain; charset=utf-8' always; | ||
add_header 'Content-Length' 0 always; | ||
return 204; | ||
} | ||
|
||
# Response to the original requests (HTTP methods are case-sensitive) with CORS enabled | ||
if ($request_method ~ (POST|GET|PUT)) { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always; | ||
add_header 'Access-Control-Allow-Headers' 'Authorization, Cache-Control, Content-Type' always; | ||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; | ||
} | ||
|
||
# Proxy reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000 of the spatial-api container | ||
include uwsgi_params; | ||
uwsgi_pass uwsgi://hubmap-ubkg-api:5000; | ||
} | ||
|
||
} | ||
|
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
nginx/conf.d-prod/ubkg-api.conf → ...conf.d-prod/data-distillery-ubkg-api.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# HuBMAP ubkg-api | ||
# Port 6666 on host maps to 6666 on container | ||
server { | ||
# Only root can listen on ports below 1024, we use higher-numbered ports | ||
# since nginx is running under non-root user hubmap | ||
listen 6666; | ||
|
||
server_name localhost; | ||
root /usr/share/nginx/html; | ||
|
||
# Logging to the mounted volume for outside container access | ||
access_log /usr/src/app/log/nginx_access_hubmap-ubkg-api.log; | ||
error_log /usr/src/app/log/nginx_error_hubmap-ubkg-api.log warn; | ||
|
||
location / { | ||
# Always enable CORS | ||
# Response to preflight requests | ||
if ($request_method = 'OPTIONS') { | ||
# The directive `add_header` doesn't work when response status code is 401, 403 or 500 | ||
# The `always` parameter is specified so the header field will be added regardless of the response code | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always; | ||
|
||
# Custom headers and headers various browsers should be OK with but aren't | ||
add_header 'Access-Control-Allow-Headers' 'Authorization, Cache-Control, Content-Type' always; | ||
|
||
# Cache the response to this preflight request in browser for 24 hours (86400 seconds) | ||
# without sending another preflight request | ||
add_header 'Access-Control-Max-Age' 86400 always; | ||
|
||
add_header 'Content-Type' 'text/plain; charset=utf-8' always; | ||
add_header 'Content-Length' 0 always; | ||
return 204; | ||
} | ||
|
||
# Response to the original requests (HTTP methods are case-sensitive) with CORS enabled | ||
if ($request_method ~ (POST|GET|PUT)) { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always; | ||
add_header 'Access-Control-Allow-Headers' 'Authorization, Cache-Control, Content-Type' always; | ||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; | ||
} | ||
|
||
# Proxy reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000 of the spatial-api container | ||
include uwsgi_params; | ||
uwsgi_pass uwsgi://hubmap-ubkg-api:5000; | ||
} | ||
|
||
} | ||
|