grailsnginxasset-pipelinegrails-3.0

Redirect location includes ":80" when X-Forwarded-Proto is https


Nginx terminates SSL for our app, communication between Nginx and app servers happens on port 8080, our app had no grails.serverURL set in config.

We had a regular redirect:

redirect uri: '/login'

But when accessed via HTTPS the redirect returned:

Location: https://domain.com:80/login

As a result browsers attempt to open SSL connections over port 80 and fail.


Solution

  • Removing the X-Forwarded-Proto header from nginx.conf or adding X-Forwarded-Port (recommended) resolved the issue.