Return-Path: X-Original-To: apmail-sling-dev-archive@www.apache.org Delivered-To: apmail-sling-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 51CA11073D for ; Wed, 5 Feb 2014 08:54:13 +0000 (UTC) Received: (qmail 78512 invoked by uid 500); 5 Feb 2014 08:54:12 -0000 Delivered-To: apmail-sling-dev-archive@sling.apache.org Received: (qmail 78250 invoked by uid 500); 5 Feb 2014 08:54:11 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 78235 invoked by uid 99); 5 Feb 2014 08:54:10 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Feb 2014 08:54:10 +0000 Date: Wed, 5 Feb 2014 08:54:10 +0000 (UTC) From: "Felix Meschberger (JIRA)" To: dev@sling.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SLING-3374) Overlay sendRedirect to get relative Location header MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)