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 www.domain.com/promotion to redirect to www.domain.com:8080/register.php?promotion=june

migrated from stackoverflow.com 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.


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.


The module mod_rpaf will handle this for you. Our fork at https://github.com/gnif/mod_rpaf has improvements for the port and SSL and is the official source now.


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.

Your Answer

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