Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Varnish 2 with Apache backend at 8080 on the same machine. Everything is working fine, except one problem: Sometimes Apache(?) is redirecting to backend port :8080 especially when I'm using htaccess. Users are displayed the 8080 port in the URL and Google is crawling my site on the backend port as well, which is not desirable.

I want Apache 8080 to be accessible only to Varnish on localhost, and not to redirect or display the backend port.

What would be a quick way to prevent users being directed to 8080 and search engines denied crawling the backend?

Here is an example htaccess line:

redirect /promotion /register.php?promotion=june

which causes to redirect to

share|improve this question

migrated from Aug 21 '11 at 12:02

This question came from our site for professional and enthusiast programmers.

To just clarify the answer from Scott as it applies to Ubuntu, probably to all Debian-based distributions as well, you can simply add mod_rpaf to your web server with:

sudo apt-get install libapache2-mod-rpaf

The module configures and reloads apache as required, there is minimal overhead, and it does exactly what you've asked for.

share|improve this answer

I've had this very such problem for slightly different reasons but the resolution to your problem will be the same all the less.

Its unfortunately a bug in Apache it seems and thus rather than me explaining the whole answer I'll send you onto a post I opened ... Sorry to post you off to a different website but its in the best interests for resolution to this question.

This will fix your problem no-worries.

share|improve this answer

The module mod_rpaf will handle this for you. Our fork at has improvements for the port and SSL and is the official source now.

share|improve this answer

You need to setup forward & reverse proxying. I have done this in Tomcat as explained here.

Haven’t done it in Varnish, but here is a post that addresses the issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.