I have an Apache Proxy setup in front of an HTTP daemon process that serves a Sinatra web application with the following Directives (which work great)

ProxyPass / http://ip-ad-dr-ess:8080/
ProxyPassReverse / http://ip-ad-dr-ess:8080/

This allows me to browse http://example.com and served the content from the daemon web server. I would like to include a wordpress blog as a subdirectory to the main site.

http://example.com <- Sinatra
http://example.com/blog <- Wordpress

Here is the entire config section

<IfModule mod_proxy_http.c>
LogLevel debug
ProxyRequests Off
ProxyPass /blog http://blog.example.com:80/
ProxyPassReverse /blog http://blog.example.com:80/
ProxyPass / http://ip-ad-dr-ess:8080/
ProxyPassReverse / http://ip-ad-dr-ess:8080/
<Location />
    RequestHeader set X-Forwarded-Protocol http
<Location /blog>
    RequestHeader set X-Forwarded-Protocol http
ProxyPreserveHost on
ProxyErrorOverride Off

The problem I am having is when I navigate to http://example.com/blog I am served content from http://example.com not from the Wordpress.

As a test, in the config above I replaced http://blog.example.com:80/ with http://www.google.com:80/ and when I navigate to http://example.com/blog I am simply redirected to Google's site (with the URL in the address bar) which is not the behavior I expected.

Any idea of how I can resolve or maybe further debug this issue as to why the wordpress content is not be served?


Update blog.exmaple.com excerpt

<VirtualHost ip-ad-dr-ess:80>
ServerAdmin webmaster@blog.example.com
DocumentRoot /home/path/blog.example.com
ServerName www.blog.example.com
ServerAlias blog.example.com
DirectoryIndex index.html index.shtml index.htm Index.html Index.htm Index.shtml$
ErrorLog /home/path/logs/blog.example.com/http.20187367/error.log
Alias /stats /home/path/logs/blog.example.com/http.20187367/html
<Directory /home/path/logs/blog.example.com/http.20187367/html>
AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes$
Alias /doc/analog /usr/share/analog
RewriteEngine on
RewriteCond %{HTTP_HOST}  =www.blog.example.com       [NC]
RewriteRule ^(.*)         http://blog.example.com$1  [R=301,NE]
  • Might be a dumb questsion, but does blog.example.com work as expected? Also you should ommit the trailing slashes from the "blog.example.com:80" or add one to the "/blog" before it Jun 21 '12 at 12:47
  • @cperrin88 the blog site does serve content as expected. I tried removing the trailing slashes, and the port number with the same result.
    – Karl
    Jun 21 '12 at 13:12
  • First of all blog.example.com needs to work correctly. If you put it in the browser on the server the blog should pop up. Otherwise the ReverseProxy can't do a thing. Is the blog servered on the same host? Jun 21 '12 at 13:14
  • @cperrin88 Yes the blog does work, and it is served on the same host
    – Karl
    Jun 21 '12 at 13:18

You should try adding a trailing slash the path "/blog" like this

ProxyPass /blog/ http://blog.example.com/
ProxyPassReverse /blog/ http://blog.example.com/
  • http://example.com/blog returns a 404 (from the example.com application) and http://example.com/blog/ serves the content from the main site example.com/
    – Karl
    Jun 21 '12 at 13:39
  • The first error is normal because the resourcees /blog and /blog/ are different. You need to write a rewrite rule to send the /blog requests to /blog. The Second error is more puzzling as you say that blog.example.com works fine. I can't see the problem here. I guess the problem lies somewhere in the config of blog.examlpe.com. Jun 21 '12 at 13:48
  • Would you mind posting the config of blog.example.com Jun 21 '12 at 13:54
  • Yes, the issue is that http://example.com and http://example.com/blob/ are rending the same content. Maybe seeing the live site will clear things up. http://getdropstream.com and http://getdropstream.com/blog/
    – Karl
    Jun 21 '12 at 13:54
  • Is there anything specific you want to see from blog.example.com?
    – Karl
    Jun 21 '12 at 13:55

I was able to solve this issue. The root cause was that the I setup a proxy from one virtualhost to another on the same ip and the same port.

I changed the blog.example.com to listen on a different port, updated the proxy values in http://example.com which resolved the problem

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.