All static content requests going to Jboss EAP 7.1 , instead of looking in Webserver - apache

Recently, I migrated from Jboss EAP 6.4 to Jboss EAP 7.1.
I have a Jboss EWS in front of Jboss EAP, with mod cluster to connect to them.
I use some static content which is kept in websever (Jboss EWS).
While accessing the webserver URL it used to server the static content in websever.
However, after migrating to JBoss EAP 7.1, it is looking for static content in Appserver and giving 404. This possibly is due to new addition of undertow, which wasn't in place in Jboss EAP 6.x
What changes should I do ( possibly in undertow config) so that it looks for static content in webserver itself, instead of appservers.

You need to add file handler and another location to the undertow subsystem in standalone.xml to serve static content (like images):
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/img" handler="images"/>
</host>
</server>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
<file name="images" path="/var/images" directory-listing="true"/>
</handlers>

Related

How to set context path in Tomcat 8 for link and script tags

I have a web-site that I have deployed locally on IIS/ColdFusion but Tomcat/Lucee in production (the production server is Windows Server). Tomcat is not running as a Windows Service
I am trying to set up virtual directories since IIS and Tomcat seem to handle relative paths differently. I have a virtual directory called "/style" set in IIS that points to my style sheet directory which works just fine. When I try to modify the server.xml file in Tomcat8, it never works.
I am using the following tag in my cfm header file:
<link rel="Stylesheet" media="screen" href="/style/styles.css">
Here is a portion of my server.xml file:
<Host name="127.0.0.1" appBase="webapps" unpackWARs="true" autoDeploy="true">
<context path="/style" docBase="C:\lucee\tomcat\webapps\ROOT\mysite\_style" ></context>
I have tried moving the context to different locations within the server.xml file, I have tried different context attributes. Nothing seems to work.
Any suggestions?
I used the information from the following link:
https://www.petefreitag.com/item/867.cfm
and used the following:
<Context path=""
docBase="C:\lucee\tomcat\webapps\ROOT"
WorkDir="C:\lucee\tomcat\temp">
<Resources>
<PreResources base="C:\lucee\tomcat\webapps\ROOT\mysite\_style"
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/mysite/style"/>
</Resources>
</Context>

Apache Tomcat virtual directories. Redirects to wrong location. ColdFusion Lucee

I am trying to get a local version of Lucee ColdFusion running my app - which resides as two directories... the main app, and the client custom code.
To that myDomain.com should pull from the 'site' and myDomain.com/app/ should pull from the app.
I can be logged in to my site, and pulling data via includes etc, but if I try to browse (or make a call to) /app/cfc/myCFC.cfc ...
the behavior redirects to the 'root' and logs my app out.
my server XML looks like this
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN" >
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Service name="Catalina" >
<Connector port="8888"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8009"
protocol="AJP/1.3"
redirectPort="8443" />
<Engine name="Catalina"
defaultHost="127.0.0.1" >
<Host name="local.dev.myDomain.com" appBase="webapps" >
<Context path="/" docBase="C:\wwwroot\site" />
<Context path="/app" docBase="C:\wwwroot\app" />
</Host>
</Engine>
</Service>
</Server>
If it helps to understand; this is a legacy app running in production on Windows, Apache 2.2 and ColdFusion 11. I have the app aliased in Apache 2.2 like this:
Alias /app/ C:/wwwroot/app
I am trying to evaluate Lucee to see if our app will work on that platform without too many changes.
One noticeable difference, due to using the built in webserver, is the port 8888
so the actual url looks like: mydomain.com:8888/app/cfc
I do not know if this is the problem or something else. If I cannot find a solution, I'll install Apache 2.2 and match the config
Any help is greatly appreciated - jp
NOTE: I just changed the host in this txt to accurately mimic my setup - if that makes a difference.
local.dev.myDomain.com (only the 'myDomain' is specifically my domain, not literally myDomain)

Tomcat server.xml redirection: new class files not loaded

I have have a domain name (for example myapp.com) that I am using it to redirect to a web application (for exmple "myapp"), which is deployed on my tomcat server (for example in "myserver.es/myapp"). I added this fragment to the server.xml file of the tomcat to configure the redirection:
<Host name="myapp.com" appBase="webapps/myapp"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="."/>
<Alias>www.myapp.com</Alias>
</Host>
Apparently it is working good, if I write "mydomain.com" in the browser the app is shown correctly.
The problem: when I generate a new WAR file of that app and I upload it to the Tomcat server (after stopping and undeploying the previous version), the changes related with Java code are not shown. I have to restart my tomcat server to access to the last version of the app from "myapp.com".
In contrast, if I access to "mydomain.com/myapp", I can see the last version of the app, showing the changes made in the last WAR.
So, I think that the problem is related with the redirection. It is anything wrong with the previous XML code?
The other "Host" configured in the server.xml is this one:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
You might be having issues with Parallel Deployement
You could set undeployOldVersions="true" inside your host to see if that works.
Finally, I've discovered the solution! I needed to set privileged="true" inside the Context tag.

How to connect JBoss AS 7.1.1 with IIS 7 using Apache ISAPI Redirector 1.2.37

I am trying to migrate my web app from JBoss EAP 5 to AS 7.1.1 and I am not able to get the IIS requests redirected to JBoss Web (Tomcat) on Windows 2008 R2 X64.
I have the filter authorized and running in IIS and pointing to the proper DLL and properties files and followed all the instructions I could find to get this working under JB 7 (it worked under JB 5). I am missing the last step which no one seems to be covering in their posts and answers.
Where do you make the changes to connect JBoss Web to port 8009 used by the AJP 1.3 connector?. Most of the examples refer to updating the connector in the server.xml file in JBOSS_HOME/server/default/Deploy/jbossweb.sar.
I don’t have anything like that under the new JBOSS_HOME/standalone/deployments folder. Where is JBoss Web configured?
Thank you for any pointers or examples you could supply.
Finally figured it out, the problem was a missing ajp connector that had to be defined in standalone.xml in the web subsystem as follows:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="eStar-Host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl/>
</connector>
<connector name="ajp13" protocol="AJP/1.3" scheme="http" socket-binding="ajp" redirect-port="8443"/>
<virtual-server name="eStar-Host" enable-welcome-root="true">
<alias name="localhost"/>
</virtual-server>
</subsystem>

How do I create a web service with HTTPS endpoint in Apache CXF

I have Apache as front-end to my Tomcat server where I have deployed a CXF web service. All access to my web service happens through SSL which is handled by Apache web server. This means that my Tomcat server is totally unaware of SSL. As a result my CXF generated web service has a http endpoint URL. How do I make it HTTPS while giving the opportunity of handling SSL to Apache web server. Any clue to override endpoint URL scheme?
If you do that, you should also set proper address (that with HTTPS) in publishedEndpointURL.
Like here: How to start cxf service on localhost but return external address in wsdl?
This will make imports in generated WSDL point to proper URLs.
In you case you need to enable SSL connector for Tomcat (in case you use mod_proxy in Apache), or you need to to enable secured AJP connector (in case you use mod_jk):
<Connector protocol="AJP/1.3" redirectPort="443" scheme="https" secure="true" address="127.0.0.1" port="8009" />
CXF is out of game here.
I had the same problem, and solved it by using a JNDI lookup for a base URL, then constructing a url for publishEndpointUrl. In XML config, it looks something like this:
<jee:jndi-lookup id="ProxyURL" jndi-name="myProxyURL" resource-ref="true" cache="true" />
<bean id="EndpointURL" class="java.lang.String">
<constructor-arg value="#{ProxyURL+'/myServiceAddress'}"/>
</bean>
<jaxws:endpoint
id="myServiceEndpoint"
...[other parameters]...
publishedEndpointUrl="#EndpointURL">