Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Aug 21 '11 at 12:02

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

4 Answers 4

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.

http://www.linuxquestions.org/questions/linux-server-73/apache-server-mod_rewrite-problem-892985/

This will fix your problem no-worries.

share|improve this answer

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.

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

 
discard

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