2

I have both Apache and Wildfly installed on a Ubuntu 14.04 system. Now I'd like to make Wildfly (locally http://localhost:8080) accessible from Apache (http://webserver/wildfly). How would I have to do that?

Sofar, I've enabled the two mods: proxy and proxy_http. And I've added at the end of the document /etc/apache2/apache2.conf:

ProxyRequests off
ProxyPass /wildfly/ http://localhost:8080/
ProxyPassReverse /wildfly/ http://localhost:8080/

EDIT:

Now half of it works, but the paths are not transformed right. The path to one of my apps running on Wildfly is:

http://webserver/wildfly/testproj/Index.xhtml

But all links on its page are processed like this:

http://webserver/testproj/Page1.xhtml
http://webserver/testproj/Page2.xhtml
http://webserver/testproj/Page3.xhtml

rather than this:

http://webserver/wildfly/testproj/Page1.xhtml
http://webserver/wildfly/testproj/Page2.xhtml
http://webserver/wildfly/testproj/Page3.xhtml

If I run Wildfly locally, everything works fine. This lets me believe that there must be an error in the Apache Reverse Proxy configuration. Is that right? What must I do to have Apache parse the right addresses / links?

  • What says netstat -anp | grep 8080 ? – krisFR Jun 14 '15 at 23:47
  • tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 1083/java – Socrates Jun 15 '15 at 0:19
  • have you tried accessing wildfly using the URL http://localhost/wildfly/? Mind the trailing slash! – Alexander Janssen Jun 15 '15 at 6:32
  • I have edited the above question. Plz take a look. – Socrates Jun 21 '15 at 18:24
0

I hope that you solved your problem, but in case that there is someone else who my need an answer for this question here is the solution,

For web applications that are deployed outside an EAR file (WAR deployment)

In the web-inf folder

MyApp/src/main/webapp/WEB-INF/

add a jboss-web.xml file with this content where / is the root deployment if you would like to deploy it as a root for your case just change the "/" whit "testproj".

<jboss-web>
      <context-root>/</context-root>
</jboss-web>

EAR file

From the official documentation (please check the reference) you can find that inside the EAR file, the context root is defined in the application.xml file. in the following example the context root of the web-client.war is bank, so the application is set to /bank which mean that the URL will be www.domaine.com/bank

 <module>
    <ejb>bank-ejb.jar</ejb>
</module>
<module>
    <web>
        <web-uri>web-client.war</web-uri>
        <context-root>bank</context-root>
    </web>
</module>

reference : Jboss Doc - Chapter 6. Setting the context root of a web application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.