2015-12-24 5:22 GMT+03:00 George Sexton <geor...@mhsoftware.com>:
>
>
> On 12/23/2015 6:59 PM, Konstantin Kolinko wrote:
>>
>> 2015-12-24 4:09 GMT+03:00 George Sexton <geor...@mhsoftware.com>:
>>>
>>> I'm seeing an unusual behavior change going from 7.0.65 -> 7.0.67. I've
>>> confirmed this also working under 7.0.55 and not working under 7.0.67 on
>>> a
>>> different machine.
>>>
>>> The sequence is:
>>>
>>> GET /A.html
>>> POST /A.html <- Returns /A.html
>>> POST /A.html <- Redirects to B.html (tried /B.html and it doesn't work
>>> either)
>>>
>>> on 7.0.65, things work as as expected.
>>>
>>> on 7.0.67, the final post returns a 404, not found error.
>>>
>>> I'm using CATALINA_BASE/CATALINA_HOME and the configuration is not
>>> changed.
>>>
>>> Is this change in behavior expected? If the behavior is expected, could
>>> someone elaborate on what I'm doing wrong, and what I should be doing?
>>
>> How are you sending the redirect? What API are you using?
>
>
> HttpServletResponse.sendRedirect()
>

>From tcpdump that 404 response has "Content-Length: 0".
(It is visible from access log as well)

It means that error page handling was not involved, as if the error
was triggered by lower levels of Tomcat.

In the implementation of o.a.c.connector.Response.sendRedirect() [1]
there is try/catch(IllegalArgumentException e) that does fallback to
setStatus(SC_NOT_FOUND);
It may be that it is the cause of 404 status.

The use of java.net.URI.create() to parse the location URL here is
new,  trying to avoid using home-grew toAbsolute() URL handling.
Maybe it has issues with the redirect URL that you are using.

Setting useRelativeRedirects="false" will fallback to the old behaviour.


[1] 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_67/java/org/apache/catalina/connector/Response.java?view=markup#l1393


>>
>> There is a new feature, controlled by useRelativeRedirects attribute on
>> Context.
>> You can see it mentioned in release announcement at
>> http://tomcat.apache.org/
>
>
> My assumption was the default was to preserve the old behavior. That's what
> I got reading the changelog. Perhaps I mis-interpreted that.

The useRelativeRedirects setting is documented here:
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to