Yeah, the wizard is a bit brain dead in this regard, IMO. The assumption is that the path part of the URL will be the same at the Gateway as at the back end service. Per Barry's answer, you need to rewrite the path to remove the extraneous elements and use the new variable in the routing assertion. Copy and paste the following XML into your policy. It introduces to new assertions to assign ${path} and regex it to remove ^/foo/bar, then shows it being used in a replacement routing assertion:
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<L7p:SetVariable>
<L7p:Base64Expression stringValue="JHtyZXF1ZXN0LnVybC5wYXRofQ=="/>
<L7p:VariableToSet stringValue="path"/>
</L7p:SetVariable>
<L7p:Regex>
<L7p:AutoTarget booleanValue="false"/>
<L7p:OtherTargetMessageVariable stringValue="path"/>
<L7p:Regex stringValue="^/foo/bar"/>
<L7p:Replace booleanValue="true"/>
<L7p:Replacement stringValue=""/>
<L7p:Target target="OTHER"/>
</L7p:Regex>
<L7p:HttpRoutingAssertion>
<L7p:FailOnErrorStatus booleanValue="false"/>
<L7p:ProtectedServiceUrl stringValue="http://${webAppHost}${path}${query}"/>
<L7p:ProxyPassword stringValueNull="null"/>
<L7p:ProxyUsername stringValueNull="null"/>
<L7p:RequestHeaderRules httpPassthroughRuleSet="included">
<L7p:ForwardAll booleanValue="true"/>
<L7p:Rules httpPassthroughRules="included"/>
</L7p:RequestHeaderRules>
<L7p:RequestParamRules httpPassthroughRuleSet="included">
<L7p:ForwardAll booleanValue="true"/>
<L7p:Rules httpPassthroughRules="included"/>
</L7p:RequestParamRules>
<L7p:ResponseHeaderRules httpPassthroughRuleSet="included">
<L7p:ForwardAll booleanValue="true"/>
<L7p:Rules httpPassthroughRules="included"/>
</L7p:ResponseHeaderRules>
</L7p:HttpRoutingAssertion>
</wsp:All>
</wsp:Policy>