0
votes

I want that whenever the user types http://localhost:8280/services/Facebook/sea the actual request should be http://localhost:8280/services/Facebook/search?q=jack . This is the part of my synapse.xml configuration for the proxy service Facebook. But its not working , whats wrong with the configuration ?

<proxy name="Facebook" transports="https http" startOnLoad="true" trace="disable">
        <target>
            <endpoint>
                <address uri="http://graph.facebook.com"/>
            </endpoint>
            <inSequence>
                <rewrite>
                    <rewriterule>
                        <action value="search?q=jack" regex="sea" type="replace" fragment="host"/>
                    </rewriterule>
                </rewrite>
                <log level="full"/>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
    </proxy>
1

1 Answers

0
votes

The section which needs to be replaced is in the path of the URL. So you should set the fragment attribute to "path". The query section should be set using a separate action:

        <rewrite>
             <rewriterule>
                <action value="search" regex="sea" type="replace" fragment="path"/>
                <action value="q=jack" type="set" fragment="query"/>
             </rewriterule>
        </rewrite>