mbaechler/proxy-servlet — Issue #10: Error accessing webapp context root if ProxyServlet mapped to /*
Author: cdanger
Created: 2012-01-24 00:09:57+00:00
State: open

Hello, I am using proxy-servlet 1.0.2
with web.xml:
----

Archetype Created Web Application

ProxyServlet
com.woonoz.proxy.servlet.ProxyServlet

target-url
http://www.programme-tv.net

ProxyServlet
/*

----------------
If webapp is deployed with context root "/test-proxy" on my local server (say port 8080), and I browse to URL:
http://localhost:8080/test-proxy/

It fails with following exception

java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.substring(String.java:1934)
at com.woonoz.proxy.servlet.UrlRewriterImpl.removeTrailingSlashes(UrlRewriterImpl.java:116)
at com.woonoz.proxy.servlet.UrlRewriterImpl.appendPathFragments(UrlRewriterImpl.java:107)
at com.woonoz.proxy.servlet.UrlRewriterImpl.rewritePathIfNeeded(UrlRewriterImpl.java:100)
at com.woonoz.proxy.servlet.UrlRewriterImpl.rewriteUri(UrlRewriterImpl.java:62)
at com.woonoz.proxy.servlet.HttpRequestHandler.execute(HttpRequestHandler.java:78)
at com.woonoz.proxy.servlet.ProxyServlet.doGet(ProxyServlet.java:83)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)