[
https://issues.apache.org/jira/browse/SLING-3374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13891929#comment-13891929
]
Felix Meschberger commented on SLING-3374:
------------------------------------------
Technically we can (and in an internal discussion I may actually have
stipulated that we) implement the sendRedirect method in Sling to return a
relative path.
There are two problems, though with respect to specification compliance:
# The Servlet API spec requires the
[sendRedirect|http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#sendRedirect%28java.lang.String%29]
method to set an absolute URL on the Location header.
# The current HTTP/1.1 spec (RFC 2616) mandates the
[Location|http://tools.ietf.org/html/rfc2616#section-14.30] header to be an
absolute URI (which is considered a bug to be fixed in the upcoming HTTP spec:
http://www.greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-25.html#header.location).
Given that the HTTP spec is being updated and most if not all modern browsers
today support relative URI Location headers, it would be conceivable to wrap
the sendRedirect method to always use a relative URL instead of forcing an
absolute one.
But then: what would be the benefit of having a relative URL as opposed to an
absolute URL ? Could it be that the HttpServletRequest.getServerName and
HttpServletRequest.getServerPort yield wrong (or unexpected) values behind a
caching proxy ?
> Overlay sendRedirect to get relative Location header
> ----------------------------------------------------
>
> Key: SLING-3374
> URL: https://issues.apache.org/jira/browse/SLING-3374
> Project: Sling
> Issue Type: Bug
> Reporter: Laurie byrum
>
> Recently, Location headers returned from redirects started being absolute
> instead of relative.
> We should try to decorate this in sling.
> Can we replace the sendRedirect with a set-header set-status combination
> in sling?
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)