0 Replies Latest reply on May 28, 2014 9:16 PM by jp-cr

    Wildfly 8 / Undertow how to add the rewrite rules

    jp-cr Newbie

      Hi!

       

      I need help to find some documentation about how to add a set of rules to rewrite requests. I need redirect from HTTP to HTTPS (ex: my login page). I've tried to find something in the documentation, but I can't.

       

      This is what I have on JBoss 7.1.0

       

       <virtual-server name="default-host" enable-welcome-root="true">
              <alias name="localhost"/>
           <rewrite pattern=".*" substitution="https://localhost%{REQUEST_URI}" flags="L,R,NC">
                <condition test="%{SERVER_PORT}" pattern="!^443$" flags="NC"/>
                <condition test="%{REQUEST_URI}" pattern=".*login\.htm$" flags="NC,OR"/>
           </rewrite>
           <rewrite pattern=".*" substitution="http://localhost%{REQUEST_URI}" flags="L,R,NC">
                <condition test="%{SERVER_PORT}" pattern="^443$" flags="NC"/>
                <condition test="%{REQUEST_URI}" pattern="!.*login\.htm$" flags="NC"/>
                <condition test="%{REQUEST_URI}" pattern=".*\.htm$" flags="NC"/>
           </rewrite>
      </virtual-server>
      

       

      Thanks for your answer!