Skip to content

Commit

Permalink
correct nginx rule forwarding header
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jan 9, 2014
1 parent d4cc367 commit 1b8a32b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions config/nginx.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ upstream discourse {
# server unix:/var/www/discourse/tmp/sockets/puam.sock;
# }


# attempt to preserve the proto, must be in http context
map $http_x_forwarded_proto $thescheme {
default $scheme;
https https;
}

server {

listen 80;
Expand Down Expand Up @@ -88,11 +95,6 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# attempt to preserve the proto
map $http_x_forwarded_proto $thescheme {
default $scheme;
https https;
}

proxy_set_header X-Forwarded-Proto $thescheme;
proxy_set_header Host $http_host;
Expand Down
3 changes: 1 addition & 2 deletions script/bench.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ def bench(path)
append = "?api_key=#{api_key}&api_username=admin1"

# asset precompilation is a dog, wget to force it
run "wget http://127.0.0.1:#{@port}/ -o test.html"
`rm test.html`
run "wget http://127.0.0.1:#{@port}/ -o /dev/null"

tests = [
["home", "/"],
Expand Down

0 comments on commit 1b8a32b

Please sign in to comment.