Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard matcher and $ in URL causes exception #71

Closed
GoogleCodeExporter opened this issue Jul 5, 2015 · 4 comments
Closed

Wildcard matcher and $ in URL causes exception #71

GoogleCodeExporter opened this issue Jul 5, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Issue comes with Google App Engine usage of dollar sign with url's - as far as 
I understand from the following logs:

06-14 06:19AM 20.073 /$%7Bfavicon%7D 500 28ms 19cpu_ms 3kb Mozilla/5.0 
(Windows; U; Windows NT 5.1; fi; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 
FireTorrent/2.0.1 ( .NET CLR 3.5.30729),gzip(gfe)
See details

195.74.27.30 - - [14/Jun/2010:06:19:20 -0700] "GET /$%7Bfavicon%7D HTTP/1.1" 
500 3414 - "Mozilla/5.0 (Windows; U; Windows NT 5.1; fi; rv:1.9.2.3) 
Gecko/20100401 Firefox/3.6.3 FireTorrent/2.0.1 ( .NET CLR 3.5.30729),gzip(gfe)"

06-14 06:19AM 20.090

/$%7Bfavicon%7D
java.lang.IllegalArgumentException: Illegal group reference
    at java.util.regex.Matcher.appendReplacement(Unknown Source)
    at org.tuckey.web.filters.urlrewrite.utils.WildcardMatcher.replaceAll(WildcardMatcher.java:118)
    at org.tuckey.web.filters.urlrewrite.RuleBase.matchesBase(RuleBase.java:242)
    at org.tuckey.web.filters.urlrewrite.NormalRule.matches(NormalRule.java:88)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRuleProcessing(RuleChain.java:79)
    at org.tuckey.web.filters.urlrewrite.RuleChain.process(RuleChain.java:133)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:140)
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
    at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:250)
    at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5838)
    at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5836)
    at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
    at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:398)
    at com.google.net.rpc.impl.Server$2.run(Server.java:852)
    at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
    at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:576)
    at com.google.net.rpc.impl.Server.startRpc(Server.java:807)
    at com.google.net.rpc.impl.Server.processRequest(Server.java:369)
    at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:442)
    at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
    at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
    at com.google.net.async.Connection.handleReadEvent(Connection.java:474)
    at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:831)
    at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
    at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:103)
    at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
    at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:413)
    at java.lang.Thread.run(Unknown Source)

My guess is that url rewriting will stuck if url includes '$'-sign. The problem 
comes out even with Spring Roo generated simple application.

Original issue reported on code.google.com by tomi.laurell@gmail.com on 15 Jun 2010 at 7:38

@GoogleCodeExporter
Copy link
Author

urlrewrite.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" 
"http://tuckey.org/res/dtds/urlrewrite3.0.dtd">

<urlrewrite default-match-type="wildcard">
    <rule>
        <from>/resources/**</from>
        <to last="true">/resources/$1</to>
    </rule>
    <rule>
        <from>/static/WEB-INF/**</from>
        <set type="status">403</set>
        <to last="true">/static/WEB-INF/$1</to>
    </rule>
    <rule>
        <from>/static/**</from>
        <to last="true">/$1</to>
    </rule>
    <rule>
        <from>/</from>
        <to last="true">/app/index</to>     
    </rule>
    <rule>
        <from>/app/**</from>
        <to last="true">/app/$1</to>
    </rule>
    <rule>
        <from>/**</from>
        <to>/app/$1</to>
    </rule>
    <outbound-rule>
        <from>/app/**</from>
        <to>/$1</to>
    </outbound-rule>    
</urlrewrite>

Original comment by tomi.laurell@gmail.com on 15 Jun 2010 at 7:51

@GoogleCodeExporter
Copy link
Author

Any work arounds for this?

Original comment by agile.in...@cyetain.com on 14 Jul 2010 at 3:25

@GoogleCodeExporter
Copy link
Author

This is only affecting wildcard match type.  As a temporary workaround you 
could use regular expressions.

This will be fixed in version 4, see:
http://code.google.com/p/urlrewritefilter/source/detail?r=292

Original comment by tuc...@gmail.com on 29 Jul 2010 at 12:27

  • Changed title: Wildcard matches and $ in URL causes exception
  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by tuc...@gmail.com on 29 Jul 2010 at 12:27

  • Changed title: Wildcard matcher and $ in URL causes exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant