Salman Rafique
Salman Rafique

Reputation: 33

how to rewrite the url in lowercase in WSO2

I have a gateway URL: https://baseurl/1.0.0/Api/Users/Login and require to rewrite in lower case using URLRewrite Mediator.

Require to navigate here: https://baseurl/1.0.0/api/users/login What should I set in value, type and fragment attributes.

<rewrite>
  <rewriterule>
      <action value="tolowercase{url}" type="set" fragment="path"/>
  </rewriterule>
</rewrite>

Upvotes: 0

Views: 174

Answers (1)

Lakshitha
Lakshitha

Reputation: 1031

Instead of URL rewrite mediator, you can easily get this done with property mediator.

<sequence xmlns="http://ws.apache.org/ns/synapse" name="NewAPI:v1.0.0--In">
    <property name="URL_POSTFIX" expression="get-property('axis2','REST_URL_POSTFIX')" />
    <property name="URL_POSTFIX_LOWER_CASE" expression="lower-case(get-property('URL_POSTFIX'))"/>
    <property name="REST_URL_POSTFIX" expression="get-property('URL_POSTFIX_LOWER_CASE')" scope="axis2" />
</sequence>

Upvotes: 1

Related Questions