-
-
Notifications
You must be signed in to change notification settings - Fork 971
Description
#10879 made it possible to create a partial URL in the Location HTTP-header for redirects. This yields a correct Location HTTP-header as long as server.servlet.context-path is not set. However, if server.servlet.context-path is set, then the context-path is not included in the Location HTTP-header which is incorrect and prevents the clients from following the redirect.
Task List
- Steps to reproduce provided
- Stacktrace (if present) provided
- Example that reproduces the problem uploaded to Github
- Full description of the issue provided (see below)
Steps to Reproduce
- Create a new Grails app
- Set
server.servlet.context-pathto e.g. "app" in application.yml - Create TestController and OtherController
- Let TestController redirect to OtherController:
redirect(absolute: false, controller: 'other')and let OtherController render some text. - Start the app and call TestController with curl:
curl -iL http://localhost:8080/app/test
Expected Behaviour
Expected text response from OtherController after redirect. Location HTTP-header should be: http://localhost:8080/app/other
Actual Behaviour
Gets HTTP-status 404, because Grails does not add context path to the partial Location HTTP-header. Location HTTP-header was: http://localhost:8080/other
Environment Information
- Operating System: Ubuntu 20.04
- Grails Version: 4.0.6
- JDK Version: openjdk version "1.8.0_275"