0

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

4 Answers4

1

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.

0

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.

Mark
  • 236
  • 1
  • 3
0

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.

Scott Mcintyre
  • 269
  • 1
  • 2
0

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.

Giacomo1968
  • 3,522
  • 25
  • 38