krasimir/navigo

case sensitive routes

tpezzelle opened this issue · 1 comments

i've seen the 2 other posts regarding case sensitive routes and have tried the

Navigo.MATCH_REGEXP_FLAGS = 'i'

but to no avail... is there any additional info on how/when/where to implement this assignment so that it works?

in case anyone else wanders across this using IIS.... here's what seems to be working for me. add the block to <system.webservers> in web.config. the first rule does a redirect to the route, but in lower case. the second rule does a rewrite to assure that all routes load the default.html page.

<rewrite>
  <rules>
    <rule name="ToLowerCase" stopProcessing="true">
      <match url="[A-Z]" ignoreCase="false" />
      <action type="Redirect" url="{ToLower:{URL}}" />          
    </rule>
    <rule name="SPA Routes" stopProcessing="true">
      <!-- match everything by default -->
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/default.html" />
    </rule>
  </rules>
</rewrite>