Merge 3116eedc0a
into 51aeee9a2c
This commit is contained in:
commit
e722f9ea80
2 changed files with 29 additions and 4 deletions
25
nginx.tmpl
25
nginx.tmpl
|
@ -19,11 +19,18 @@
|
||||||
|
|
||||||
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
||||||
# scheme used to connect to this server
|
# scheme used to connect to this server
|
||||||
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
map $http_x_forwarded_proto $default_forwarded_proto {
|
||||||
default $http_x_forwarded_proto;
|
default $http_x_forwarded_proto;
|
||||||
'' $scheme;
|
'' $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If we received a HTTP-CloudFront-Forwarded-Proto, pass it through; otherwise,
|
||||||
|
# pass along the original value.
|
||||||
|
map $http_cloudfront_forwarded_proto $proxy_x_forwarded_proto {
|
||||||
|
default $http_cloudfront_forwarded_proto;
|
||||||
|
'' $default_forwarded_proto;
|
||||||
|
}
|
||||||
|
|
||||||
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
|
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
|
||||||
# Connection header that may have been passed to this server
|
# Connection header that may have been passed to this server
|
||||||
map $http_upgrade $proxy_connection {
|
map $http_upgrade $proxy_connection {
|
||||||
|
@ -33,9 +40,19 @@ map $http_upgrade $proxy_connection {
|
||||||
|
|
||||||
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
|
log_format vhost '{"time": "$time_iso8601", '
|
||||||
'"$request" $status $body_bytes_sent '
|
'"host": "$host", '
|
||||||
'"$http_referer" "$http_user_agent"';
|
'"remote_addr": "$remote_addr", '
|
||||||
|
'"remote_user": "$remote_user", '
|
||||||
|
'"body_bytes_sent": "$body_bytes_sent", '
|
||||||
|
'"request_time": "$request_time", '
|
||||||
|
'"status": "$status", '
|
||||||
|
'"request": "$request", '
|
||||||
|
'"request_uri": "$uri", '
|
||||||
|
'"request_method": "$request_method", '
|
||||||
|
'"http_referrer": "$http_referer", '
|
||||||
|
'"http_x_forwarded_for": "$http_x_forwarded_for", '
|
||||||
|
'"http_user_agent": "$http_user_agent"}';
|
||||||
|
|
||||||
access_log off;
|
access_log off;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,14 @@ function setup {
|
||||||
# THEN querying the proxy with any other Host header → 200
|
# THEN querying the proxy with any other Host header → 200
|
||||||
run curl_container $SUT_CONTAINER / --head --header "Host: something.I.just.made.up"
|
run curl_container $SUT_CONTAINER / --head --header "Host: something.I.just.made.up"
|
||||||
assert_output -l 0 $'HTTP/1.1 200 OK\r'
|
assert_output -l 0 $'HTTP/1.1 200 OK\r'
|
||||||
|
|
||||||
|
# THEN querying the proxy with X-Forwarded-Proto → 200
|
||||||
|
run curl_container $SUT_CONTAINER / --head --header "X-Forwarded-Proto: https"
|
||||||
|
assert_output -l 0 $'HTTP/1.1 200 OK\r'
|
||||||
|
|
||||||
|
# THEN querying the proxy with HTTP-CloudFront-Forwarded-Proto → 200
|
||||||
|
run curl_container $SUT_CONTAINER / --head --header "HTTP-CloudFront-Forwarded-Proto: https"
|
||||||
|
assert_output -l 0 $'HTTP/1.1 200 OK\r'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "[$TEST_FILE] stop all bats containers" {
|
@test "[$TEST_FILE] stop all bats containers" {
|
||||||
|
|
Loading…
Reference in a new issue