Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

say I have a wordpress site:

and I want to have an entry point to a rails app at a certain subdirectory within that same domain:

I know this is possible if both the wordpress app and the rails app are hosted on the same box, but is this in anyway possible if they are hosted on different boxes?

I do not want to use subdomains because I am trying to allow ajax post requests from one to the other and not having to deal with single origin policy stuff.

share|improve this question

Not exactly, but close.

The host with the rails app needs to have its own distinct hostname. But you can create a Revere Proxy from the primary domain to the rails app.

Add the following to your Apache virtual host for

ProxyPass           /rails_app
ProxyPassReverse    /rails_app

Obviously you'll need to make sure the URL on the right is correct for your application.

share|improve this answer
will this approach still get around the single origin policy so that I can do XHR posts from the rails app to wordpress? – patrick Oct 3 '12 at 21:36

Not that I am aware - you'd need to point the A records for both pages to the same server. Sub-domains work because it's a different set of A records that can be pointed to another IP address in your DNS manager.

share|improve this answer

You'll need to reverse proxy from one host to the other host -- any modern web server can handle this with ease. If you're doing this with shared hosting, your web host may not be especially amenable to that.

On the other hand, you can also just run WordPress and your Rails app on the same host.

share|improve this answer

I find the simplest way to achieve the desired results is to write an agent on the web host that passes the information between servers. i.e.

  • The web server makes an AJAX request to the agent
  • The agent sends the request verbatim to the app server and waits for a response
  • The app server replies to the agent
  • The agent forwards the reply the web server

Only the traffic between the web server and agent is AJAX. The traffic between the agent and app server is just regular network traffic.

share|improve this answer

Your Answer


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

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