<?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>Admins Goodies &#187; reverse-proxy</title>
	<atom:link href="http://adminsgoodies.com/tag/reverse-proxy/feed/" rel="self" type="application/rss+xml" />
	<link>http://adminsgoodies.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 20 May 2013 16:34:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>reverse proxy that caches post requests</title>
		<link>http://adminsgoodies.com/reverse-proxy-that-caches-post-requests/</link>
		<comments>http://adminsgoodies.com/reverse-proxy-that-caches-post-requests/#comments</comments>
		<pubDate>Sun, 23 Dec 2012 16:37:19 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reverse-proxy]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/reverse-proxy-that-caches-post-requests/</guid>
		<description><![CDATA[I understand that varnish caches &#8220;GET&#8221; and &#8220;HEAD&#8221; requests by default. My backend servers fail when I do a get request that is too long, so I made them respond to POST instead of GET. This works great, but I need a reverse proxy which can be configured to cache POST responses just like GET. Are there any reverse proxies that can cache these post requests? Asked by nurettin It seems nginx does cache POST [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I understand that varnish caches &#8220;GET&#8221; and &#8220;HEAD&#8221; requests by default. </p>
<p>My backend servers fail when I do a get request that is too long, so I made them respond to POST instead of GET. This works great, but I need a reverse proxy which can be configured to cache POST responses just like GET. </p>
<p>Are there any reverse proxies that can cache these post requests?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/149961/nurettin" target="_blank">nurettin</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>It seems nginx does cache POST requests if you specify it.</p>
<blockquote>
<pre class="prettyprint"><code>proxy_cache_methods POST; # GET HEAD
proxy_cache_key "$uri|$request_body";
client_max_body_size 10k; # 413
</code></pre>
</blockquote>
<div class="author">Answered by <a href="http://serverfault.com/users/149961/nurettin" target="_blank">nurettin</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/459940/reverse-proxy-that-caches-post-requests" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/reverse-proxy-that-caches-post-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>varnish delete least requested files</title>
		<link>http://adminsgoodies.com/varnish-delete-least-requested-files/</link>
		<comments>http://adminsgoodies.com/varnish-delete-least-requested-files/#comments</comments>
		<pubDate>Thu, 20 Dec 2012 17:36:16 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[disk-cache]]></category>
		<category><![CDATA[reverse-proxy]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/varnish-delete-least-requested-files/</guid>
		<description><![CDATA[I see that varnish can be configured to set -smalloc or -sfile with a certain size. I want to set a file cache of 1G such that least requested files are deleted first when cache is full. Is this possible in varnish? Is there another reverse proxy tool that can do this? Asked by nurettin Varnish uses &#8220;least recently used&#8221; (LRU), for more information see: https://www.varnish-cache.org/trac/wiki/ArchitectureLRU Answered by KM01 Check more discussion of this question.]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I see that varnish can be configured to set -smalloc or -sfile with a certain size.</p>
<p>I want to set a file cache of 1G such that least requested files are deleted first when cache is full. Is this possible in varnish? Is there another reverse proxy tool that can do this?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/149961/nurettin" target="_blank">nurettin</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Varnish uses &#8220;least recently used&#8221; (LRU), for more information see: <a href="https://www.varnish-cache.org/trac/wiki/ArchitectureLRU" rel="nofollow">https://www.varnish-cache.org/trac/wiki/ArchitectureLRU</a></p>
<div class="author">Answered by <a href="http://serverfault.com/users/47016/km01" target="_blank">KM01</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/459675/varnish-delete-least-requested-files" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/varnish-delete-least-requested-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTPS variable in $_SERVER using nginx as reverse proxy</title>
		<link>http://adminsgoodies.com/https-variable-in-_server-using-nginx-as-reverse-proxy/</link>
		<comments>http://adminsgoodies.com/https-variable-in-_server-using-nginx-as-reverse-proxy/#comments</comments>
		<pubDate>Wed, 07 Nov 2012 17:36:07 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reverse-proxy]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/https-variable-in-_server-using-nginx-as-reverse-proxy/</guid>
		<description><![CDATA[I&#8217;m using nginx as a reverse proxy in front of an apache with mod_php. My site is on https, and it would require the variable $_SERVER['HTTPS'] to be set &#8216;on&#8217; to assemble some of the links correctly. My site is on drupal, so it is not an option to fix the code and check an other variable when deciding if the site runs under https. Is there a way to fix the issue only with [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;m using nginx as a reverse proxy in front of an apache with mod_php. My site is on https, and it would require the variable $_SERVER['HTTPS'] to be set &#8216;on&#8217; to assemble some of the links correctly. My site is on drupal, so it is not an option to fix the code and check an other variable when deciding if the site runs under https.</p>
<p>Is there a way to fix the issue only with tweaking the nginx or apache configuration?</p>
<p>I found other people asking similar questions, but I did not found a solution that suits me, neither a clear statement that what I want is not possible.</p>
<p>(e.g.: <a href="http://serverfault.com/questions/195491/https-server-php-variable-not-available">HTTPS server/php variable not available</a>,<br />
       <a href="http://serverfault.com/questions/386755/nginx-strip-header-on-http-add-header-on-https">Nginx : strip header on HTTP, add header on HTTPS</a>) </p>
<div class="author">Asked by <a href="http://serverfault.com/users/84181/mimrock" target="_blank">mimrock</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You can use a directive <code>SetEnv HTTPS "on"</code> in Apache main configuration or in .htaccess to set the required variable to on unconditionally.</p>
<p>Or better &#8211; set it only if client address equals the address of Nginx frontend. In this case the variable won&#8217;t be set if clients request Apache directly without SSL:</p>
<pre><code>SetEnvIf Remote_Addr "NGINX_IP_ADDRESS" HTTPS=on
</code></pre>
<div class="author">Answered by <a href="http://serverfault.com/users/92325/fedor-piecka" target="_blank">Fedor Piecka</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/446294/https-variable-in-server-using-nginx-as-reverse-proxy" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/https-variable-in-_server-using-nginx-as-reverse-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx reverse proxy and IIS</title>
		<link>http://adminsgoodies.com/nginx-reverse-proxy-and-iis/</link>
		<comments>http://adminsgoodies.com/nginx-reverse-proxy-and-iis/#comments</comments>
		<pubDate>Sat, 20 Oct 2012 16:33:33 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reverse-proxy]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/nginx-reverse-proxy-and-iis/</guid>
		<description><![CDATA[I&#8217;m using nginx as a reverse proxy for website running on IIS 7.5. Website is bound to sub-1.foo.bar. Nginx configuration looks like this: server { listen 80; server_name sub.foo.bar; location / { proxy_pass http://sub-1.foo.bar; proxy_set_header Host $host; proxy_set_header X-Accel-Expires 0; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } What I want to do is forward requests which come to sub.foo.bar (linux machine with nginx) to sub-1.foo.bar (windows machine with IIS and my website). However what [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;m using nginx as a reverse proxy for website running on IIS 7.5. Website is bound to <code>sub-1.foo.bar</code>. Nginx configuration looks like this:</p>
<pre><code>server {
    listen 80;    server_name sub.foo.bar;    location / {
        proxy_pass http://sub-1.foo.bar;
        proxy_set_header Host $host;
        proxy_set_header X-Accel-Expires 0;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
</code></pre>
<p>What I want to do is forward requests which come to <code>sub.foo.bar</code> (linux machine with nginx) to <code>sub-1.foo.bar</code> (windows machine with IIS and my website). However what happens is</p>
<ul>
<li>when I access sub.foo.bar, I get 404 page</li>
<li>when I access sub-1.foo.bar directly I get my website served normally from IIS</li>
<li>nginx seems to forward requests normally to windows machine</li>
<li>I can&#8217;t see any incoming requests from IIS logs when I access sub.foo.bar</li>
<li>when I add binding for sub.foo.bar on IIS, website gets proxied normally with nginx</li>
</ul>
<p>I would appreciate any ideas on what might be wrong with my setup. Thanks!</p>
<div class="author">Asked by <a href="http://serverfault.com/users/55329/yojimbo87" target="_blank">yojimbo87</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Try to manually add proxy_set_header Host &#8220;sub-1.foo.bar&#8221;</p>
<div class="author">Answered by <a href="http://serverfault.com/users/122393/hex" target="_blank">Hex</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/440486/nginx-reverse-proxy-and-iis" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/nginx-reverse-proxy-and-iis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSL Proxy: Forwarding without the encryption</title>
		<link>http://adminsgoodies.com/ssl-proxy-forwarding-without-the-encryption/</link>
		<comments>http://adminsgoodies.com/ssl-proxy-forwarding-without-the-encryption/#comments</comments>
		<pubDate>Tue, 16 Oct 2012 16:33:32 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[reverse-proxy]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/ssl-proxy-forwarding-without-the-encryption/</guid>
		<description><![CDATA[I have a python application listening on port 9001 for HTTP traffic. I&#8217;m trying to configure Apache (or anything, really) to listen on port 443 for HTTPS connections, and then forward the connection, sans encryption, to port 9001 on the same machine. My application would then reply via the proxy, where the encryption would be reapplied, and returned to the client transparently. I&#8217;m not doing anything crazy with the site names and SSL certs, I [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I have a python application listening on port 9001 for HTTP traffic.</p>
<p>I&#8217;m trying to configure Apache (or anything, really) to listen on port 443 for HTTPS connections, and then forward the connection, sans encryption, to port 9001 on the same machine. My application would then reply via the proxy, where the encryption would be reapplied, and returned to the client transparently.</p>
<p>I&#8217;m not doing anything crazy with the site names and SSL certs, I have one public IP, one hostname, and one SSL cert. Stripping the encryption at the proxy doesn&#8217;t seem to be a common requirement.</p>
<p>Is what I&#8217;m asking for a normal requirement? Are there other concerns with this sort of configuration?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/141233/john" target="_blank">John</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Pretty simple, really.  You want a virtual host with encryption, then a proxy to a non-encrypted HTTP endpoint.</p>
<pre><code>&lt;VirtualHost *:443&gt;
    ServerName www.example.com
    SSLEngine On
    SSLCertificateFile /path/to/cert.pem
    SSLCertificateKeyFile /path/to/cert.key
    ProxyPass / http://localhost:9091/
    ProxyPassReverse / http://localhost:9091/
&lt;/VirtualHost&gt;
</code></pre>
<div class="author">Answered by <a href="http://serverfault.com/users/72586/shane-madden" target="_blank">Shane Madden</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/438773/ssl-proxy-forwarding-without-the-encryption" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/ssl-proxy-forwarding-without-the-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Providing a static IP for resources behind AWS Elastic Load Balancer (ELB)</title>
		<link>http://adminsgoodies.com/providing-a-static-ip-for-resources-behind-aws-elastic-load-balancer-elb/</link>
		<comments>http://adminsgoodies.com/providing-a-static-ip-for-resources-behind-aws-elastic-load-balancer-elb/#comments</comments>
		<pubDate>Tue, 02 Oct 2012 16:33:55 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[amazon-elastic-ip]]></category>
		<category><![CDATA[amazon-elb]]></category>
		<category><![CDATA[amazon-web-services]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[reverse-proxy]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/providing-a-static-ip-for-resources-behind-aws-elastic-load-balancer-elb/</guid>
		<description><![CDATA[I need a static IP address that handles SSL traffic from a known source (a partner). The reason the IP needs to be static is that the partner requires this in order to maintain the PCI compliance. Our servers are behind an AWS Elastic Load Balancer (ELB), which cannot provide a static IP address; many threads about this here. My thought is to create an instance in EC2 whose sole purpose in life is to [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I need a static IP address that handles SSL traffic from a known source (a partner).  The reason the IP needs to be static is that the partner requires this in order to maintain the PCI compliance.  </p>
<p>Our servers are behind an AWS Elastic Load Balancer (ELB), which cannot provide a static IP address; many threads about this here.</p>
<p>My thought is to create an instance in EC2 whose sole purpose in life is to be a reverse proxy server having it&#8217;s own IP address; accepting HTTPS requests and forwarding them to the load balancer.</p>
<p>Are there better solutions?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/73780/tharrison" target="_blank">tharrison</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>In the end, I implemented the requirement of our partner as follows:</p>
<ul>
<li>launch an instance in AWS</li>
<li>allocate and attach an Elastic IP (EIP) to it</li>
<li>Installed Apache</li>
<li>(in our case, installed our SSL certificate)</li>
<li>Configured Apache as a reverse proxy server, forwarding to a CNAME that pointed to our ELB</li>
</ul>
<p>Here&#8217;s a sample Apache virtual host configuration. I turned <em>off</em> <code>NameVirtualHost</code> and specified the address of our EIP. I also disabled a default host.  If the partner desires, I will add a <code>&lt;Directory&gt;</code> block that accepts requests only from <em>their</em> IP range.</p>
<pre><code>&lt;IfModule mod_ssl.c&gt;
# Catch non-SSL requests and redirect to SSL
&lt;VirtualHost 12.34.567.890:80&gt;
  ServerName our-static-ip-a-record.example.com
  Redirect / https://our-elb-cname.example.com       
&lt;/VirtualHost&gt;
# Handle SSL requests on the static IP
&lt;VirtualHost 12.34.567.890:443&gt;
  ServerAdmin monitor@example.com
  ServerName our-static-ip-a-record.example.com  # SSL Configuration
  SSLEngine on
  SSLProxyEngine on
  SSLProxyCACertificateFile /etc/apache2/ssl/gd_bundle.crt
  SSLCertificateFile    /etc/apache2/ssl/example.com.crt    
  SSLCertificateKeyFile /etc/apache2/ssl/private.key
  # Additional defaults, e.g. ciphers, defined in apache's ssl.conf  # Where the magic happens
  ProxyPass / https://our-elb-cname.example.com/
  ProxyPassReverse / https://our-elb-cname.example.com/  # Might want this on; sets X-Forwarded-For and other useful headers
  ProxyVia off  # This came from an example I found online, handles broken connections from IE
  BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
  # MSIE 7 and newer should be able to use keepalive
  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
&lt;/VirtualHost&gt;
&lt;/IfModule&gt;
</code></pre>
<p>Hope this saves someone else some time in the future <img src='http://adminsgoodies.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="author">Answered by <a href="http://serverfault.com/users/73780/tharrison" target="_blank">tharrison</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/432743/providing-a-static-ip-for-resources-behind-aws-elastic-load-balancer-elb" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/providing-a-static-ip-for-resources-behind-aws-elastic-load-balancer-elb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Rewrite or Proxy to internal server</title>
		<link>http://adminsgoodies.com/apache-rewrite-or-proxy-to-internal-server/</link>
		<comments>http://adminsgoodies.com/apache-rewrite-or-proxy-to-internal-server/#comments</comments>
		<pubDate>Wed, 01 Aug 2012 16:33:08 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[mod-rewrite]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[reverse-proxy]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/apache-rewrite-or-proxy-to-internal-server/</guid>
		<description><![CDATA[First off, this is my first go at apache, so please forgive my beginingingismness My basic setup is as such: mysub.domain.com gets sent to my static IP via a CNAME entry at godaddy&#8217;s DNS manager. It hits my Ubuntu 10 LTS server running Apache2. I have a virtual host entry that directs that request to the proper /var/www/mysub folder. I don&#8217;t have any content in there, but I added a line to the &#8220;It Works&#8221; [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>First off, this is my first go at apache, so please forgive my beginingingismness <img src='http://adminsgoodies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>My basic setup is as such:  <code>mysub.domain.com</code> gets sent to my static IP via a CNAME entry at godaddy&#8217;s DNS manager.  It hits my Ubuntu 10 LTS server running Apache2.  </p>
<p>I have a virtual host entry that directs that request to the proper <code>/var/www/mysub</code> folder.  I don&#8217;t have any content in there, but I added a line to the &#8220;It Works&#8221; page so I&#8217;d know if I got there successfully.  I also have a Mac Mini running a wiki server on the same local network as the Ubuntu server.  </p>
<p>I&#8217;d like <code>mysub.domain.com</code> to hit my Mini server instead of the <code>/var/www/mysub</code> folder.</p>
<p>After much reading on this site and others, I&#8217;ve managed to do it&#8230; kind of.</p>
<p>I have the following in my <code>/var/www/mysub/.htacess</code>, which I found in another SF question (forgot to copy the link).</p>
<pre><code>RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysub.domain.com/*
RewriteRule .* http://192.168.x.x/ [P,L]
</code></pre>
<p>This works insomuch as it does redirect <code>mysub.domain.com</code> to the Mini&#8217;s front page.  But of course, so does every subsequent link click on the Mini page.  I think I understand why it&#8217;s doing it (anything that starts with <code>mysub.domain.com</code> gets directed to what is essentially the front page of the wiki server, and since subsequent links on the wiki server also include <code>mysub.domain.com</code>, it always ends up in the same place)</p>
<p>I just don&#8217;t know what to do different.  To be perfectly honest, I don&#8217;t actually understand the syntax of those Rewrite lines.</p>
<hr />
<p>I&#8217;ve seen countless examples of config entries and tried some of them, but without really understanding the syntax, it&#8217;s kind of shooting in the dark.</p>
<p><a href="http://www.netlobo.com/ubuntu_apache_modules.html" rel="nofollow">This</a> was a useful post, and after reading <a href="http://www.netlobo.com/ubuntu_apache_modules.html" rel="nofollow">this</a> question, I tried adding this to my <code>/apache2/httpd.conf</code> file</p>
<pre><code>&lt;Location /&gt;
   ProxyPass http://192.168.x.x
   ProxyPassReverse http://192.168.x.x
&lt;/Location&gt;
</code></pre>
<p>No luck.  </p>
<p>Clearly, I have some learning to do, but it would seem to me that what I want to do is probably quite simple.  What am I missing?</p>
<hr />
<p><strong>EDIT PER COMMENTS</strong></p>
<p>My <code>/etc/apache2/httpd.conf</code> file</p>
<pre><code>ServerName localhost&lt;VirtualHost *:80&gt;
   ServerName domain.com
   ServerAlias www.domain.com
   DocumentRoot /var/www/domain
&lt;/VirtualHost&gt;&lt;VirtualHost *:80&gt;
   ServerName mysub.domain.com
   DocumentRoot /var/www/mysub
   &lt;Location /&gt;
      ProxyPass http://192.168.x.x/
      ProxyPassReverse http://192.168.x.x/
   &lt;/Location&gt;
&lt;/VirtualHost&gt;
</code></pre>
<p>&#8230; and my <code>sites-available/mysub</code> file&#8230;</p>
<pre><code>&lt;VirtualHost *:80&gt;
        ServerAdmin me@domain.com
        ServerName mysub.domain.com
        DocumentRoot /var/www/mysub        #ProxyRequests Off
        &lt;Location /&gt;
                ProxyPass http://192.168.1.50/
                ProxyPassReverse http://192.168.1.50/
        &lt;/Location&gt;
        &lt;Directory /&gt;
                Options FollowSymLinks
                AllowOverride None
        &lt;/Directory&gt;
        &lt;Directory /var/www/mysub&gt;
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        &lt;/Directory&gt;        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        &lt;Directory "/usr/lib/cgi-bin"&gt;
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        &lt;/Directory&gt;        ErrorLog /var/log/www/mysub/error.log        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn        CustomLog /var/log/apache2/access.log combined    Alias /doc/ "/usr/share/doc/"
    &lt;Directory "/usr/share/doc/"&gt;
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    &lt;/Directory&gt;
</code></pre>
<p>Output of <code>apache2ctl -S</code></p>
<pre><code>VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server 66-152-109-110.tvc-ip.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost 66-152-109-110.tvc-ip.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost domain.com (/etc/apache2/sites-enabled/domain:1)
         port 80 namevhost mysub.domain.com (/etc/apache2/sites-enabled/mysub:1)
Syntax OK
</code></pre>
<div class="author">Asked by <a href="http://serverfault.com/users/123250/josh" target="_blank">Josh</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You&#8217;re very close!</p>
<p>A couple notes:</p>
<ul>
<li>
<p><code>RewriteCond %{HTTP_HOST} ^mysub.domain.com/*</code> &#8211; The <code>HTTP_HOST</code> variable only contains <code>mysub.domain.com</code>, not the rest of the path.</p>
<p>This rule actually matches, but accidentally &#8211; there&#8217;s no <code>/</code> character there, but the <code>*</code> modifier applies to the <code>/</code> character, meaning &#8220;repeat the <code>/</code> 0 to infinite times&#8221;.</p>
<p>Apache uses perl-compatible regex &#8211; to match the exact host, it should look like this: </p>
<pre><code>RewriteCond %{HTTP_HOST} ^mysub\.domain\.com$
</code></pre>
</li>
<li>
<p><code>RewriteRule .* http://192.168.x.x/ [P,L]</code> &#8211; This is only loading the home page since it&#8217;s not including the rest of the passed path &#8211; this must be manually done when using the <code>[P]</code> flag of <code>RewriteRule</code>.</p>
<p>This should work:</p>
<pre><code>RewriteRule (.*) http://192.168.x.x/$1 [P,L]
</code></pre>
</li>
<li>
<p>The <code>ProxyPass</code> setup is almost right, except it&#8217;s being overridden by the setup in the <code>.htaccess</code> file, so it&#8217;s not being used.  Using <code>.htaccess</code> is bad for performance and potentially problematic for security &#8211; see the recommendation in the Apache documentation <a href="http://httpd.apache.org/docs/current/howto/htaccess.html#when" rel="nofollow">here</a>.</p>
<p>Probably the best approach is to delete the <code>.htaccess</code> file outright, and just use <code>ProxyPass</code>.  Change your config a small bit&#8230;</p>
<pre><code>&lt;Location /&gt;
   ProxyPass http://192.168.x.x/
   ProxyPassReverse http://192.168.x.x/
&lt;/Location&gt;
</code></pre>
<p>&#8230;and move it from your <code>httpd.conf</code> over to within the <code>&lt;VirtualHost&gt;</code> block that&#8217;s serving the subdomain.</p>
<p>With the matching trailing slashes and no more <code>.htaccess</code>, this should do the trick!</p>
</li>
</ul>
<div class="author">Answered by <a href="http://serverfault.com/users/72586/shane-madden" target="_blank">Shane Madden</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/413102/apache-rewrite-or-proxy-to-internal-server" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/apache-rewrite-or-proxy-to-internal-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx inserting extra characters in Multi-status reply body</title>
		<link>http://adminsgoodies.com/nginx-inserting-extra-characters-in-multi-status-reply-body/</link>
		<comments>http://adminsgoodies.com/nginx-inserting-extra-characters-in-multi-status-reply-body/#comments</comments>
		<pubDate>Mon, 18 Jun 2012 16:33:33 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reverse-proxy]]></category>
		<category><![CDATA[webdav]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/nginx-inserting-extra-characters-in-multi-status-reply-body/</guid>
		<description><![CDATA[Here&#8217;s the setup. I&#8217;ve got one server running apache/php hosting ownCloud. Among other things, I&#8217;m using to do CardDAV contact syncing. In order to make things work with my domain I have an nginx server running on the frontend as a reverse-proxy to the ownCloud server. My nginx config is as follows: server { listen 80; server_name cloud.mydomain.com; location / { proxy_set_header X-Forwarded-Host cloud.mydomain.com; proxy_set_header X-Forwarded-Proto http; proxy_set_header X-Forwarded-For $remote_addr; client_max_body_size 0; proxy_redirect off; proxy_pass [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>Here&#8217;s the setup. I&#8217;ve got one server running apache/php hosting ownCloud. Among other things, I&#8217;m using to do CardDAV contact syncing. In order to make things work with my domain I have an nginx server running on the frontend as a reverse-proxy to the ownCloud server. My nginx config is as follows:</p>
<pre><code>server {
    listen       80;
    server_name  cloud.mydomain.com;    location / {
        proxy_set_header X-Forwarded-Host cloud.mydomain.com;
        proxy_set_header X-Forwarded-Proto http;
        proxy_set_header X-Forwarded-For $remote_addr;
        client_max_body_size 0;
        proxy_redirect off;
        proxy_pass      http://server;
    }
}
</code></pre>
<p>The problem is that when my phone does a <code>PROPFIND</code> on the server, nginx adds extra characters to the content body that throw the phone off. Specifically, it prepends <code>d611\r\n</code> at the front of the body and appends <code>0\r\n\r\n</code> to the end of the content. (I got this from wireshark.) It also re-chunks the result. How do I get nginx to send the original content as-is?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/125011/user125011" target="_blank">user125011</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>The additional characters you are seeing is the <a href="http://en.wikipedia.org/wiki/Chunked_transfer_encoding#Format" rel="nofollow">chunked transfer encoding format</a>. The number is the length of the chunk, and the <code>\r\n</code>&#8216;s are delimiters. It seems that the phone does not support chunked transfer encoding (although if it declares that it supports HTTP 1.1 it is supposed to). You can disable chunked transfer encoding with the <a href="http://wiki.nginx.org/HttpCoreModule#chunked_transfer_encoding" rel="nofollow"><code>chunked_transfer_encoding</code></a> directive.</p>
<pre><code>chunked_transfer_encoding off;
</code></pre>
<div class="author">Answered by <a href="http://serverfault.com/users/115189/mgorven" target="_blank">mgorven</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/399633/nginx-inserting-extra-characters-in-multi-status-reply-body" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/nginx-inserting-extra-characters-in-multi-status-reply-body/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reasons to have a use a reverse proxy on a website not serving static content (Django)?</title>
		<link>http://adminsgoodies.com/reasons-to-have-a-use-a-reverse-proxy-on-a-website-not-serving-static-content-django-2/</link>
		<comments>http://adminsgoodies.com/reasons-to-have-a-use-a-reverse-proxy-on-a-website-not-serving-static-content-django-2/#comments</comments>
		<pubDate>Fri, 01 Jun 2012 16:33:58 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reverse-proxy]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/reasons-to-have-a-use-a-reverse-proxy-on-a-website-not-serving-static-content-django-2/</guid>
		<description><![CDATA[For a website I&#8217;m developing all my static content is hosted offsite on a combination of S3/Cloudfront. I&#8217;ve been looking over a lot of tutorials for deploying a Django app into production and a lot of them recommend a combination of Nginx (reverse proxy) + Apache. This is stated under the assumption that Ngnix will be used for serving static contents and Apache will do all the heavy lifting. Are there any other reasons to [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>For a website I&#8217;m developing all my static content is hosted offsite on a combination of S3/Cloudfront. I&#8217;ve been looking over a lot of tutorials for deploying a Django app into production and a lot of them recommend a combination of Nginx (reverse proxy) + Apache. This is stated under the assumption that Ngnix will be used for serving static contents and Apache will do all the heavy lifting. Are there any other reasons to have a reverse proxy when I don&#8217;t have any static contents to serve? Or in this case could I simplify my server setup and just use Apache?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/14356/whatwhat" target="_blank">whatWhat</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Nginx will help in your use case as well. Generally, like any reverse proxy, it helps to utilize server resources more optimally with two major techniques:</p>
<ol>
<li>As you correctly pointed out, it serves static content, thus freeing a heavy-weight web server from doing this.</li>
<li>But it also solves the problem of &#8220;slow clients&#8221;, i.e. those clients who use slow connections (dial-up or mobile). Since Apache generates a dynamic page pretty fast, Nginx gets it, stores to the temporary file and serves it to the client at the client&#8217;s speed (much like it would serve a static content), freeing Apache to serve another request.</li>
</ol>
<div class="author">Answered by <a href="http://serverfault.com/users/12729/alexander-azarov" target="_blank">Alexander Azarov</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/270228/reasons-to-have-a-use-a-reverse-proxy-on-a-website-not-serving-static-content-d" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/reasons-to-have-a-use-a-reverse-proxy-on-a-website-not-serving-static-content-django-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparently forward SSH connections to NATed Servers</title>
		<link>http://adminsgoodies.com/transparently-forward-ssh-connections-to-nated-servers/</link>
		<comments>http://adminsgoodies.com/transparently-forward-ssh-connections-to-nated-servers/#comments</comments>
		<pubDate>Tue, 29 May 2012 16:33:21 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[reverse-proxy]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/transparently-forward-ssh-connections-to-nated-servers/</guid>
		<description><![CDATA[I&#8217;ve been trying this for a long time and I have not yet found a good solution. I have several servers behind a NAT that all run an SSH daemon. One of the machines is my main server which gets the SSH port forwarded to it. What I want is basically open a connection to other NATed servers by going through the main server similar to what I can achieve by opening a connection to [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;ve been trying this for a long time and I have not yet found a good solution. I have several servers behind a NAT that all run an SSH daemon. One of the machines is my main server which gets the SSH port forwarded to it. What I want is basically open a connection to other NATed servers by going through the main server similar to what I can achieve by opening a connection to the main server and then SSHing in to the destination. Since there are some applications that run on top of SSH I&#8217;d like to make automate this in order to run rsync or git on top of the connection itself.</p>
<p>Is there a reverse proxy for SSH?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/36192/cdecker" target="_blank">cdecker</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You can do this using <code>ProxyCommand</code> and <code>netcat</code> in <code>.ssh/config</code>:</p>
<pre><code># Your 'gateway' server.
Host gateway# Any other server.
Host server1
  ProxyCommand ssh gateway /bin/netcat %h %p
</code></pre>
<p>If you do <code>ssh server1</code>, you will open an SSH connection from your current location to your &#8216;gateway&#8217; server, which will open a TCP connection to <code>server1</code>. This TCP connection will serve as the connection for SSH between your current location and <code>server1</code>.</p>
<p>Edit: This technique is commonly called &#8216;ssh jumphost&#8217;.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/118112/oliver" target="_blank">Oliver</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/393603/transparently-forward-ssh-connections-to-nated-servers" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/transparently-forward-ssh-connections-to-nated-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
