# This configuration works with the S2I image defined in https://github.com/BCDevOps/s2i-nginx
|
|
|
|
server {
|
|
listen 8080;
|
|
server_name _;
|
|
|
|
# Allows non-standard headers like SMGOV_USERGUID
|
|
ignore_invalid_headers off;
|
|
|
|
# default path
|
|
location / {
|
|
proxy_pass http://edivorce-django:8080;
|
|
proxy_pass_request_headers on;
|
|
|
|
# rewrite 302 redirect responses to absolute URL's so the justice proxy
|
|
# doesn't mangle them by adding double slashes to relative URL's
|
|
proxy_redirect http://edivorce-django:8080 https://justice.gov.bc.ca;
|
|
|
|
# remove directories from incoming requests;
|
|
rewrite ^/divorce-dev$ / last;
|
|
rewrite ^/divorce-test$ / last;
|
|
rewrite ^/divorce$ / last;
|
|
|
|
rewrite ^/divorce-dev(.*)$ $1 last;
|
|
rewrite ^/divorce-test(.*)$ $1 last;
|
|
rewrite ^/divorce(.*)$ $1 last;
|
|
}
|
|
|
|
merge_slashes off;
|
|
# replace merge_slashes' behavior with "rewrite double slashes"
|
|
location ~* "//" {
|
|
rewrite ^(.*)//(.*)$ $1/$2;
|
|
}
|
|
|
|
# static no rewrite (dev)
|
|
location /divorce-dev/static/ {
|
|
#todo: add caching
|
|
proxy_pass http://edivorce-django:8080;
|
|
proxy_pass_request_headers on;
|
|
}
|
|
|
|
# static no rewrite (test)
|
|
location /divorce-test/static/ {
|
|
#todo: add caching
|
|
proxy_pass http://edivorce-django:8080;
|
|
proxy_pass_request_headers on;
|
|
}
|
|
|
|
# static no rewrite (prod)
|
|
location /divorce/static/ {
|
|
#todo: add caching
|
|
proxy_pass http://edivorce-django:8080;
|
|
proxy_pass_request_headers on;
|
|
}
|
|
|
|
# For status of ngnix service
|
|
location /nginx_status {
|
|
# Enable Nginx stats
|
|
stub_status on;
|
|
|
|
# No need to log this request, its just noise
|
|
access_log off;
|
|
}
|
|
}
|