这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@sonicdoe
Copy link
Contributor

@sonicdoe sonicdoe commented Jul 9, 2015

If I have an app which only responds to HTTPS requests (or redirects non-secure requests to HTTPS) any checks defined in the CHECKS file will fail. This isn’t a problem for “real requests” as nginx sets the X-Forwarded-Proto header accordingly.

I therefore suggest setting the X-Forwarded-Proto header to https when running checks against a TLS-enabled app.

@michaelshobbs
Copy link
Member

Seems reasonable. Have you used this in a live environment?

@sonicdoe
Copy link
Contributor Author

sonicdoe commented Jul 9, 2015

I have (only) tested the change with this simple Express app:

app.enable('trust proxy')

app.get('/', function(request, response) {
  if(!request.secure) {
    return response.redirect(301, 'https://' + request.get('Host') + request.url)
  }

  response.send('Hello World!')
})

@michaelshobbs
Copy link
Member

#1300 comes with some test fixes. can you rebase once I merge that?

@sonicdoe
Copy link
Contributor Author

sonicdoe commented Jul 9, 2015

No problem.

@michaelshobbs
Copy link
Member

g2g

michaelshobbs added a commit that referenced this pull request Jul 9, 2015
Set X-Forwarded-Proto header if TLS is enabled when running checks
@michaelshobbs michaelshobbs merged commit 7ffca93 into dokku:master Jul 9, 2015
@sonicdoe sonicdoe deleted the x-forwarded-proto-https branch July 10, 2015 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants