<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Devon Hillard&#039;s Digital Sanctuary &#187; Apache</title>
	<atom:link href="http://www.digitalsanctuary.com/tech-blog/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://www.digitalsanctuary.com/tech-blog</link>
	<description>Java, ATG, Seam, and related Technologies</description>
	<lastBuildDate>Mon, 30 Jan 2012 23:04:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Improving ATG Performance With a CDN</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-atg-performance-with-a-cdn.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-atg-performance-with-a-cdn.html#comments</comments>
		<pubDate>Mon, 19 Jan 2009 23:13:57 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[ATG]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=231</guid>
		<description><![CDATA[Why use a CDN? A Content Delivery Network, or CDN, is essentially a system of geographically distributed web servers which serve static content, typically images, video, and other bandwidth intensive files. This serves two purposes: it keeps your servers from &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/java/atg/improving-atg-performance-with-a-cdn.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Why use a CDN?</h3>
<p>A Content Delivery Network, or CDN, is essentially a system of geographically distributed web servers which serve static content, typically images, video, and other bandwidth intensive files.  This serves two purposes: it keeps your servers from having to handle those requests and it serves those files to the end user from a low latency server closer to the user (network-wise).  Both of these aspects improve the user&#8217;s perception of page and site performance.  CDNs can also be extremely useful for things like streaming video or other very high bandwidth uses.  </p>
<h3>How do CDNs work?</h3>
<p>CDNs typically work in one of two ways: for some you have to deploy the files to the CDN manually via FTP or some similar mechanism while others work as a transparent proxy automatically loading the files from the source or origin (your servers) into the CDN as users request them.  The latter is preferable as you don&#8217;t need to take the CDN into consideration when building your application&#8217;s page and referencing media, this also makes handling non-production environments more complex.  Also it allows the media to be reloaded from the origin based on cache expiration headers, so you don&#8217;t need to do anything special during deployments of new media.  However those CDN solutions also seem to be more expensive, so it&#8217;s a balance you have to weigh yourself.</p>
<h3>Roll Your Own Apache Pseudo CDN</h3>
<p>You can also roll a pseudo-CDN yourself using Apache.  I call it a pseudo-CDN because unlike Akamai and other large providers you don&#8217;t get the advantages of hundreds or thousands of geographically distributed servers.  You also don&#8217;t get lots of fancy math routing user&#8217;s requests to the quickest servers based on location, network congestion, and more.  What you do get is transparent proxying and off-loading the request handling from your application servers.  </p>
<p>This means you don&#8217;t have to do anything special or complex when coding your web application and your JSPs to facilitate the CDN, and it means that your application servers are freed up from having to handle the requests for static media, large and small, which means they have more CPU time available for handling the real dynamic processing of your web application.</p>
<p>Apache makes this simple by way of the mod_disk_cache module.  I&#8217;d recommend avoiding the mod_mem_cache.  Even though it sounds like it would be the preferred caching mechanism, I have had significant problems with mem_cache, and have abandoned it.  If you&#8217;re using Linux (and you should be) the kernel&#8217;s ability to aggressively cache recently accessed files means that when you&#8217;re using mod_disk_cache, Apache will cache the files you specify on the local hard drive and will use all available RAM to cache those files in memory for rapid serving.  If you plan on using <a href="http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html">mod_gzip and mod_disk_cache together, please read my post on the issues encountered using them together</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-atg-performance-with-a-cdn.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Improving JSP Serving Time for an ATG Application</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-jsp-serving-time-for-an-atg-application.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-jsp-serving-time-for-an-atg-application.html#comments</comments>
		<pubDate>Mon, 12 Jan 2009 23:15:54 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[ATG]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=200</guid>
		<description><![CDATA[Improving the performance of the JSPs that serve your HTML pages is the first step in improving the overall site performance. The user&#8217;s browser can not start rendering the page or requesting the secondary media. Also the faster the page &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/java/atg/improving-jsp-serving-time-for-an-atg-application.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Improving the performance of the JSPs that serve your HTML pages is the first step in improving the overall site performance.  The user&#8217;s browser can not start rendering the page or requesting the secondary media.  Also the faster the page request is completed, the sooner you have a thread free to handle the next request.</p>
<p>There are two parts to this:  first, the time it takes the JSP servlet to generate the HTML response, and secondly the time it takes to transmit that HTML response back to the user&#8217;s browser.</p>
<h3>Caching content sections</h3>
<p>The easiest way to reduce the time it takes for the JSP servlet to generate the response is by reducing the amount of dynamic content on the page.  Or more precisely by reducing the amount of real-time or unique individual content on the page.  </p>
<p>The Cache droplet is THE most under-utilized ATG droplet.</p>
<p>The Cache droplet caches the rendered output of the contents of the oparam based on a content key (such as category, user gender, logged in/logged out state, etc..) for a configured period of time.  This can be very useful for things like navigation menus dynamically built based on the catalog.  The catalog won&#8217;t change too often, so this dynamically generated menu can be safely cached for hours.  Or for some or all of a category or product page, when you set the key to the category id or product id.</p>
<p>Look at your pages and evaluate what parts of the page don&#8217;t change that frequently.  Even if you can only cache the page or block for five minutes, that can be a huge performance win.</p>
<p>Read on for more&#8230;.<br />
<span id="more-200"></span></p>
<p>I&#8217;ll talk about things like repository caching and other related topics when I dive into the server side of performance tuning your ATG application in a future post.</p>
<h3>Reduce CPU utilization in page rendering</h3>
<p>You&#8217;re also going to want to look at potential CPU draining elements of your pages.  Think about what has to happen to render the page.  Don&#8217;t use RQLQueryForEach if you have the Repository Id you want, just use the RepositoryLookup droplet.  Don&#8217;t loop through collections if you don&#8217;t have to.  Think through it.  If you have to do something computationally expensive, don&#8217;t do it twice.  If you need the same data later just store the first result in a param or JSP variable.</p>
<h3>Reduce the size of the HTML</h3>
<p>Now that we&#8217;ve reduced the CPU time need to render the JSP, we need to reduce the amount of time it takes to transmit to the end user.  First, we want to shrink the generated HTML.  The smaller the output HTML is, the less time it will take to transfer across the wire to the end user.  Also, you want to keep the HTML output under 100k, as Google does not index page content over the first 100k (that&#8217;s 100k ungzipped).  Also, the smaller the HTML is, the quicker the browser can parse it out into the DOM tree.  </p>
<p>Don&#8217;t use inline JavaScript or CSS styles in your JSP.  Extract them out into separate JavaScript and CSS files.  This reduces the size of the output HTML, and increases the amount of content that the browser can cache locally (more on this in my future post on secondary media).  </p>
<p>Simplify the html structure as much as you can.  Don&#8217;t use more tags than you need.  I&#8217;ve seen an amazing amount of useless nested divs on pages.  </p>
<p>Move comments from HTML comments to JSP comments (if you can).  Most comments shouldn&#8217;t be seen by end users anyhow.</p>
<p>Reduce spaces.  This is huge.  JSPs (especially ones heavy in ATG droplets) tend to generate a huge amount of extraneous spaces.  Part of it is that you generally want to format the JSP files using spaces and tabs to make it easy to see the tag hierarchy structure.  It makes development and maintenance much easier.  Unfortunately these linefeeds, tabs, and spaces get multiplied by iterative or recursive droplets, and other outputs.  </p>
<p>For instance the ATG home page source has 431 lines.  103 are blank.  The BestBuy televisions page has 2519 lines and 902 are blank.  If you take that BestBuy page, and remove the extra blank lines, comments, and inline JavaScript and CSS, it goes from 98k to 80k.  That&#8217;s a 20% size reduction, or a 20% transfer speed improvement.  </p>
<p>If you&#8217;re using JBoss the Tomcat engine has an option to strip out extraneous whitespace.  It doesn&#8217;t remove all of it, but it helps with multiple blank lines very well.  In the tomcat55.sar/conf/web.xml file add the following init param to the &lt;servlet-name>jsp&lt;/servlet-name> section:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;init-param&gt;
     &lt;param-name&gt;trimSpaces&lt;/param-name&gt;
     &lt;param-value&gt;true&lt;/param-value&gt;
&lt;/init-param&gt;
</pre>
<p>This, and other helpful performance configurations are listed in the Tuning Site Performance section of the Installation and Configuration Guide for JBoss Application Server ATG documentation.  You should really read through the whole thing, and generally follow it.</p>
<h3>Compressing the HTML response using gzip</h3>
<p>Now we&#8217;ve reduced the size of the HTML the JSP is outputting.  We can further shrink the data we need to send from our server cluster to the end user&#8217;s browser, hence making the HTML transfer faster, by compressing the HTML using gzip.  Most modern browsers understand gzipped content and decompress it on the fly.  Some don&#8217;t, and we&#8217;ll work around those in a moment.</p>
<p>Assuming you&#8217;re using JBoss for your application server and Apache for your web server, you actually have two options for gzipping the content: You can compress it from within JBoss Tomcat, or you can compress it as it passes through the Apache web server.</p>
<p>If you want to compress it within JBoss you can configure Tomcat to do that by editing the tomcat55.sar/conf/server.xml file.  Find the connector you are using (the one with port=&#8221;8080&#8243; for HTTP, or port=&#8221;8009&#8243; if you&#8217;re using AJP) and add the following properties to that section:</p>
<pre class="brush: xml; title: ; notranslate">
compression=&quot;on&quot;
compressionMinSize=&quot;2048&quot;
noCompressionUserAgents=&quot;gozilla, traviata&quot;
compressableMimeType=&quot;text/html,text/xml&quot;
</pre>
<p>That should use gzip compression for output that is html or xml, and is greater than 2k in size.</p>
<p>I prefer to perform the gzip compression in Apache instead of JBoss/Tomcat.  Firstly the Apache deflate module is more flexible than the Tomcat option, allowing greater control of compression based on path, mimetype, extension, browser, and more.  Second in a three-tier infrastructure, the web servers are typically acting as pass-through proxies, plus handling some caching perhaps (more on this later), but are generally light on CPU utilization, but higher on thread and bandwidth usage.  App servers on the other hand are using this CPUs a great deal to actually handle the dynamic application.  Gzipping the outgoing content does use some CPU power, so I prefer to have that load be on the web servers who can handle it easily, versus having it impact the application performance.</p>
<p>To make Apache gzip compress the output, you need to enable <a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" target="_new">mod_deflate</a>.</p>
<p>You then need to configure the module using settings similar to this:</p>
<pre class="brush: xml; title: ; notranslate">
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE no-gzip 

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSIE\s7  !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf|flv)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</pre>
<p>You can read more about this configuration, plus some <a href="http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html">issues that arise when using mod_disk_cache and mod_deflate together here</a>.  You can get around this by only gzipping html output from your JSPs, which you won&#8217;t be caching anyhow, however doing that in a clean fashion appears to be tricky.  The <strong>AddOutputFilterByType</strong> directive <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=31226" target="_new">doesn&#8217;t work with proxied content, and the mod_filter based approach</a> for that is only built into Apache 2.1 and 2.2, so if you&#8217;re on 2.0 it&#8217;s no good.  When I have a good solution for Apache 2.0 + ATG, I&#8217;ll post about it.</p>
<p>By gzipping the HTML we can reduce the BestBuy page further, from 80k to 14k, an additional 80% reduction.  We&#8217;ve shrunk the data that has to transfer to the end user&#8217;s computer by a total of 85% at this point.  This means the end user&#8217;s browser can parse the HTML dom tree, display the page, and start loading the secondary media (images, css, js, etc&#8230;) 85% faster.  It also means your request handling thread is now free that much faster (after doing the actual processing of the JSP servlet) and is available to handle a new request.</p>
<h3>Summary</h3>
<p>So at this point we&#8217;ve made the JSP as efficient as possible, used the Cache droplet wherever we could, reduced the size of the output HTML, and gzipped the HTML for faster transmission to the end user.  We&#8217;ve taken a 98k page and ended up only having to move 14k across the wire.</p>
<p>Next we&#8217;ll look at all those secondary media files that your page needs: JavaScript, CSS, images, video, Flash, etc&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/atg/improving-jsp-serving-time-for-an-atg-application.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Apache mod_deflate and mod_cache issues</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html#comments</comments>
		<pubDate>Tue, 18 Nov 2008 22:26:36 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[deflate]]></category>
		<category><![CDATA[mod_cache]]></category>
		<category><![CDATA[mod_deflate]]></category>
		<category><![CDATA[mod_disk_cache]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=165</guid>
		<description><![CDATA[The Problem: Using Apache mod_deflate and mod_disk_cache (or other mod_cache) together can create far too many cached files. The Background: Apache is a web server with many different modules you can load in to enhance it. Two common ones are &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>The Problem:</strong> Using Apache mod_deflate and mod_disk_cache (or other mod_cache) together can create far too many cached files.</p>
<p><strong>The Background:</strong>  Apache is a web server with many different modules you can load in to enhance it.  Two common ones are mod_deflate and mod_cache (or mod_disk_cache).</p>
<p>Mod_deflate compresses content that is sent to the webserver using gzip.  It can take 100k of html, css, or javascript, and compress it down to ~10k, before transmitting it to the user&#8217;s browser.  The browser then uncompresses it, and displays the page.  Most web servers (depending on how your site/application is structured anyway) are not CPU limited.  Therefore, you can spend some extra CPU doing the compression, and get much faster content delivery times to your users, who are often bandwidth limited.  Not only does this make pages load faster for your users, but it also allows request handling threads to complete sooner, letting your web server handle more requests.</p>
<p>Some web browsers are not able to handle gzipped content correctly, therefore it&#8217;s important to add in some logic to only send gzipped content to browsers who can handle it.  Also, there are different types of files which are already compressed and hence trying to gzip them is a waste of time and resources, such as images, video, etc&#8230;</p>
<p>A common configuration may look like this:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;Location /&gt;
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE no-gzip 

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSIE\s7  !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf|flv)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
&lt;/Location&gt;
</pre>
<p>This basically says:</p>
<p>&#8220;For files under /&#8221;<br />
&#8220;Compress them&#8221;<br />
&#8220;Unless it&#8217;s Netscape 4.x, then only compress text/html files&#8221;<br />
&#8220;Or, if it&#8217;s Netscape 4.06-4.08, then don&#8217;t compress any files&#8221;<br />
&#8220;But if it&#8217;s IE, don&#8217;t compress any files&#8221;  &#8211; NOTE: this is different than the common version you see floating around which turns back on compression for IE.  If you are loading content from a Flash swf within IE 6, that content can&#8217;t be compressed, even though IE 6 handles it fine.  Flash doesn&#8217;t for some reason.  So this setting is safer.  If you aren&#8217;t using Flash, feel free to change this.<br />
&#8220;but if it&#8217;s IE7, undo the no compression settings we made before, activating compression&#8221;<br />
&#8220;but don&#8217;t compress already compressed files like images and video&#8221;<br />
&#8220;Set the response Vary header to User-Agent so that any upstream caching or proxying won&#8217;t cache the wrong version and send a compressed version to a browser which can&#8217;t handle it, or an uncompressed version to a browser that should have gotten the compressed file&#8221;</p>
<p>Confused yet? :)</p>
<p>Mod_disk_cache allows you to specify various files to be cached on the web server and lets you set a cache expiration time, etc&#8230;  It&#8217;s of great value when those files are being served out of a web application, and not coming from the local disk.  For instance if Apache is serving files from an ATG instance, mod_disk_cache, lets you have the web server cache images, css, js, videos, etc&#8230; from your WAR.  There&#8217;s also a memory based cache, mod_mem_cache, but it&#8217;s more trouble than it&#8217;s worth, and you can trust the linux kernel to cache recently accessed files in memory anyhow.</p>
<p>Got it?</p>
<p>So this is where it gets tricky.</p>
<p>If a response has a Vary header set, mod_disk_cache will cache a different version of that file for each value of the Header that Vary references.  </p>
<p>So for a file compressed as above, there will be a different version cached for each User-Agent.  In theory this will mean that browsers which support gzip compressed content, will get the compressed content, and browsers which don&#8217;t, will get the uncompressed version.</p>
<p>In practice, due to the amazing tiny variations of the full User-Agent string, you end up with thousands of copies of the same file in your cache.  On a disk cache only a few hours old, there were over 4,400 cached copies of the same javascript file.  Each with a slightly different User Agent string, even though there were less than 10 actual browser types represented.</p>
<p>This is a problem for several reasons:  Firstly, you end up using far more disk space than you really need.  Secondly, you negate the kernel&#8217;s in-memory file caching, since those 4,000+ version of the single file are being accessed, it won&#8217;t be able to simply keep the two different files (compressed and uncompressed) in memory.  Thirdly, you make cleaning out the cache much slower, since you have to delete these thousands of extra files and their containing directories.</p>
<p><strong>The Solution:</strong>  I&#8217;m not sure&#8230;  Any ideas?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/general/apache-mod_deflate-and-mod_cache-issues.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Hiding jsessionid parameter from Google</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/hiding-jsessionid-parameter-from-google.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/general/hiding-jsessionid-parameter-from-google.html#comments</comments>
		<pubDate>Mon, 19 May 2008 21:39:34 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=106</guid>
		<description><![CDATA[If you&#8217;re running a website on JBoss you may discover that Google has indexed your pages with a jsessionid query parameter in the links. The Google crawl bot does not support cookies, therefore JBoss uses the jsessionid query parameter in &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/general/hiding-jsessionid-parameter-from-google.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re running a website on JBoss you may discover that Google has indexed your pages with a jsessionid query parameter in the links.  </p>
<p>The Google crawl bot does not support cookies, therefore JBoss uses the jsessionid query parameter in order to maintain a session state without cookies.  These query parameters can impact your Google rank and indexing efficiency as the same page can be indexed multiple times with different session ids, and dilute your ranking.  Also, it leads to ugly links.</p>
<p>If you want to still be able to support non-cookie using users, but would like Google to see cleaner links, you can use Apache&#8217;s mod_rewrite to modify the links for the Google bot only, leaving the normal functionality available to the rest of your users.</p>
<p>Assuming you have mod_rewrite enabled in your Apache instance, use this configuration in your apache config:</p>
<pre class="brush: plain; title: ; notranslate">
	# This should strip out jsessionids from google
	RewriteCond %{HTTP_USER_AGENT} (googlebot) [NC]
	ReWriteRule ^(.*);jsessionid=[A-Za-z0-9]+(.*)$ $1$2 [L,R=301]
</pre>
<p>This rule says for request where the user agent contains &#8220;googlebot&#8221; (with case insensitive matching), rewrite the URL without the jsessionid.  It seems to work nicely.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/general/hiding-jsessionid-parameter-from-google.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache Proxy Breaks RichFaces</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/apache-proxy-breaks-richfaces.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/apache-proxy-breaks-richfaces.html#comments</comments>
		<pubDate>Mon, 24 Mar 2008 07:24:19 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[Seam]]></category>
		<category><![CDATA[a4j]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/apache-proxy-breaks-richfaces.html</guid>
		<description><![CDATA[I&#8217;ve run into this twice now, so I wanted to document it here to help other folks, and to see if anyone knows the root cause of the issue. When using RichFaces with Seam, things work just fine on my &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/apache-proxy-breaks-richfaces.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve run into this twice now, so I wanted to document it here to help other folks, and to see if anyone knows the root cause of the issue.</p>
<p>When using RichFaces with Seam, things work just fine on my local development JBoss instance.  But when I deploy the same EAR file up to my production JBoss instance, which is sitting behind an Apache proxy, everything works EXCEPT the rich/ajax stuff.  </p>
<p>The issue was that the JavaScript located here: ContextRoot/a4j_3_1_4.GAorg.ajax4jsf.javascript.AjaxScript</p>
<p>would not load.</p>
<p>My Apache proxy was configured like this:</p>
<pre>
	ProxyPass /10MinuteMail balancer://mycluster/10MinuteMail/
	ProxyPass /10MinuteMail/* balancer://mycluster/10MinuteMail/
	ProxyPassReverse /10MinuteMail http://127.0.0.1:8080/10MinuteMail
</pre>
<p>With mycluster defined like this:</p>
<pre>
        <Proxy balancer://mycluster>
                AddDefaultCharset off
                Order deny,allow
                Allow from all

		BalancerMember http://127.0.0.1:8080
                #Allow from .example.com
        </Proxy>
</pre>
<p>Again, this configuration worked fine for everything EXCEPT that RichFaces JavaScript.</p>
<p>Since I am only using one node for 10MinuteMail, there is no real need for a load balancer configuration, so I replaced the configuration with this:</p>
<pre>
	ProxyPass /10MinuteMail http://127.0.0.1:8080/10MinuteMail
	ProxyPass /10MinuteMail/ http://127.0.0.1:8080/10MinuteMail/
        ProxyPassReverse /10MinuteMail/ http://127.0.0.1:8080/10MinuteMail/
</pre>
<p>Which works, and fixed the RichFaces reference.</p>
<p>So there&#8217;s your solution.  However I have no idea what the actual root cause is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/apache-proxy-breaks-richfaces.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache Proxy &amp; Making Things Look Nice</title>
		<link>http://www.digitalsanctuary.com/tech-blog/general/apache-proxy-making-things-look-nice.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/general/apache-proxy-making-things-look-nice.html#comments</comments>
		<pubDate>Fri, 19 Oct 2007 04:27:50 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/general/apache-proxy-making-things-look-nice.html</guid>
		<description><![CDATA[I recently setup a dev/build server with Jira, Confluence, Hudson, ATG (with two web apps and the atg admin), Oracle (with web admin), and Postgres (with web admin). I&#8217;m running everything independantly, and everything is listening on it&#8217;s own high &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/general/apache-proxy-making-things-look-nice.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently setup a dev/build server with <a href="http://www.atlassian.com/software/jira/" title="Jira" target="_blank">Jira</a>, <a href="http://www.atlassian.com/software/confluence/" title="Confluence" target="_blank">Confluence</a>, <a href="https://hudson.dev.java.net/" title="Hudson" target="_blank">Hudson</a>, <a href="http://www.atg.com/" title="ATG" target="_blank">ATG</a> (with two web apps and the atg admin), <a href="http://www.oracle.com/index.html" title="Oracle" target="_blank">Oracle</a> (with web admin), and <a href="http://www.postgresql.org/" title="Postgres" target="_blank">Postgres</a> (with <a href="http://phppgadmin.sourceforge.net/" title="phppgadmin" target="_blank">web admin</a>).  I&#8217;m running everything independantly, and everything is listening on it&#8217;s own high number port.  This makes the URLs ugly, and finding what you want tricky.</p>
<p>I used Apache 2.2 and mod_proxy_http to wrap all of the services in the Apache running on port 80.</p>
<p>Any Apache 2.2 installation should come with mod_proxy and mod_proxy_http.  You may need to activate them with something like this:<br />
<code>LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so<br />
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so</code></p>
<p>then set a basic configuration for security:<br />
<code>ProxyRequests Off<br />
ProxyPreserveHost On</p>
<p>&lt;Proxy *&gt;<br />
    Order deny,allow<br />
    Allow from all<br />
&lt;/Proxy&gt;</code></p>
<p>It&#8217;s best to ensure all the applications you are trying to wrap are listening at context roots, not the base URL/port.  So you want hudson on :9000/hudson/ or whatever your setup has (for instance: java -jar hudson.war &#8211;httpPost=9000 &#8211;prefix=/hudson ).  Same for Jira and everything else.</p>
<p>Then setup your proxy mappings in your apache configs.</p>
<p><code>ProxyPass           /jira       http://localhost:8080/jira<br />
ProxyPassReverse    /jira       http://localhost:8080/jira<br />
&lt;Location /jira&gt;<br />
    Order allow,deny<br />
    Allow from all<br />
&lt;/Location&gt;</code></p>
<p>Repeat for all of your applications.  Then just restart apache to pickup all the changes:</p>
<p><code>apachectl restart</code></p>
<p>So now we have Jira at host/jira, Confluence at host/confluence, Hudson at host/hudson, and so on.  Pretty, easy to book mark, easy to cross link.  It just looks more professional.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/general/apache-proxy-making-things-look-nice.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Index page issues when putting JBoss behind Apache</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/index-page-issues-when-putting-jboss-behind-apache.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/index-page-issues-when-putting-jboss-behind-apache.html#comments</comments>
		<pubDate>Thu, 09 Nov 2006 04:38:52 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[ajp13]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech/archives/9</guid>
		<description><![CDATA[So, if you&#8217;re using Seam, you usually have xhtml files which represent the pages, and then the Seam servlet takes care of rendering them. When I setup my latest project, I changed the web.xml to switch from using page.seam to &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/java/index-page-issues-when-putting-jboss-behind-apache.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, if you&#8217;re using Seam, you usually have xhtml files which represent the pages, and then the Seam servlet takes care of rendering them.  When I setup my latest project, I changed the web.xml to switch from using page.seam to page.html, to mask the back-end technology.  When I did this, I also deleted the seemly unnecessary index.html that was sitting in my view directory.  I then added this into my web.xml, just to be on the safe side:</p>
<pre><code>	&amp;lt;welcome-file-list&amp;gt;
		&amp;lt;welcome-file&amp;gt;index.html&amp;lt;/welcome-file&amp;gt;
	&amp;lt;/welcome-file-list&amp;gt;</code>
</pre>
<p><span id="more-9"></span><br />
Everything worked great, when I was hitting the tomcat instance in JBoss.  However, as soon as I deployed to my production server, and Apache2 was handling the end user connections and talking to JBoss via ajp13, I kept getting directory listings, instead of the index page.  If I typed &#8220;index.html&#8221; into the browser, it worked fine, but just going to the root of the web-app context root always delivered a directory listing.  Not at all what I wanted.</p>
<p>By putting an empty index.html file in my web-app, things worked.  I&#8217;m assuming that Apache checks to see if the resource exists, and if not, does the whole directory listing thing, ignoring the welcome-file mapping in the web-app.  I&#8217;m only guessing here, but that seems to be what happened.  If so, I&#8217;d call this a flaw in the Apache to JBoss request negotiation.  Once Apache hands off the request for the index.html, after it&#8217;s validated the resource exists, then Seam leaps in and everything works as expected.  For whatever reason, it&#8217;s only an issue when a request is issued for a directory &#8220;/&#8221;.</p>
<p>Anyhow, I don&#8217;t have all the answers, but I do have a solution for this issue if it bites you.  And I wasn&#8217;t able to find it on google myself, so hopefully this will be helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/index-page-issues-when-putting-jboss-behind-apache.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/29 queries in 0.007 seconds using disk: basic
Object Caching 633/695 objects using disk: basic

Served from: www.digitalsanctuary.com @ 2012-02-06 23:59:21 -->
