-
1. Re: How to do URL rewriting in WildFly?
ctomc Jan 22, 2014 9:38 AM (in response to marcelkolsteren)1 of 1 people found this helpfulHey,
Marcel Kolsteren wrote:
The web subsystem of JBoss AS 7 supports URL rewriting. I tried to find out how to do URL rewriting in WildFly 8, but I could not find anything in the documentation. Does WildFly 8 support it, and if the answer is yes, where can I find the documentation of this feature?
answer to your question is yes and no
Undertow supports url rewriting in its core but it is not exposed yet via management API in wildfly undertow subsystem.
you can read all about how rewriting works and undertow API for configuring it here http://lists.jboss.org/pipermail/undertow-dev/2013-July/000419.html
What you can do is write your own ServletExtension (see http://undertow.io/documentation/servlet/using-non-blocking-handlers-with-servlet.html)
Where you can then use programmatic api for configuring rewrite rules.
Support for configuring rewrite rules as part of undertow subsystem is planned but wont make 8.0.0.Final which is due by end of this month.
--
tomaz
-
2. Re: How to do URL rewriting in WildFly?
marcelkolsteren Jan 25, 2014 9:28 AM (in response to ctomc)Thanks! I succeeding in configuring rewrite rules now. It wasn't needed to write my own ServletExtension. I just added a file named "undertow-handlers.conf" to the WEB-INF of my war file, with rewriting rules like this:
regex['^/$'] -> rewrite['/Home.faces']
The drawback of this rewriting mechanism is that it is limited to the scope of one web application, while in JBoss AS 7, it was possible to rewrite at the level of the application server. I fixed this problem by moving my web application (I only have one) to the empty context root, so that I can rewrite all URLs that hit my server.
-
3. Re: How to do URL rewriting in WildFly?
daribo Jun 27, 2014 8:28 AM (in response to marcelkolsteren)But how do you rewrite and set automatically one or two parameter? I tried everything I could, but no real success. I could use path-template, but it's just not forwarding with the parameters.
For example:
regex['^/$'] -> rewrite['/Home.faces']
I would also like to send to home.faces with additional parameter ?home=blue
-
4. Re: How to do URL rewriting in WildFly?
ctomc Jun 27, 2014 9:03 AM (in response to daribo)looks like you are trying to solve application problem with infrastructure solutions.
Why not fix it in application first
i think you might find http://ocpsoft.org/prettyfaces/ useful for what you need, make JSF apps more url friendly.
-
5. Re: How to do URL rewriting in WildFly?
daribo Jun 27, 2014 9:53 AM (in response to ctomc)I know, but unfortunately it's not up to me. I just gotta deal with it and make it run... Probably for development reason and distribution of the url's rewrite rules, this piece needs to be located inside the application.
Does prettyfaces apply to Struts (maven) application as well?
-
6. Re: How to do URL rewriting in WildFly?
karthik-vasishta.ramesh Jan 14, 2015 1:21 PM (in response to marcelkolsteren)Thank you for that Marcel. This was really helpful. I'm still looking for syntax to set the NC flag (case-insensitive). Is there some place where I can find some documentation on this?