# Request routing plugin and subdomain share process

**URL:** <https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476>\
**Category:** Rails\
**Created:** [April 11, 2008, 7:21am UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476 "2008-04-11T07:21:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 7:21am UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/1 "2008-04-11T07:21:43Z")

</div>

Hi Rails Guru,

I am using the request routing plugin to implement subdomain on my  
app. To do this, I use cpanel and created bunch of subdomain, all  
pointing at the same public folder under one rails app. However, when  
request reaches a subdomain of my app, the rails fastcgi process  
doesn’t seem to use rails fastcgi process created for another  
subdomain, even though all rails fastcgi process should have the same  
content because it’s in the same rails app. How can I configure my app  
so that the fastcgi process can share among subdomains? Thanks!

---

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 10:18am UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/2 "2008-04-11T10:18:36Z")

</div>

Mongdar wrote:

> Hi Rails Guru,
> 
> I am using the request routing plugin to implement subdomain on my  
> app. To do this, I use cpanel and created bunch of subdomain, all  
> pointing at the same public folder under one rails app. However, when  
> request reaches a subdomain of my app, the rails fastcgi process  
> doesn’t seem to use rails fastcgi process created for another  
> subdomain, even though all rails fastcgi process should have the same  
> content because it’s in the same rails app. How can I configure my app  
> so that the fastcgi process can share among subdomains? Thanks!

Your problem is not related with the request routing plugin, but with  
apache not executing the dspatcher. Baybe you can post your apache  
config and .htaccess file?  
I did not have this problem because I don’t use fcgi, but when I created  
this[1] site I had some problems too with subdomains. On that page I am  
using apache → haproxy → mongrels  
So in apache I have  
ProxyPass / [http://127.0.0.1:9000/](http://127.0.0.1:9000/)  
ProxyPassReverse / [http://127.0.0.1:9000/](http://127.0.0.1:9000/)  
and every request hits a mongrel and thus the app.

[1][shameless spam] [http://diffuse.it](http://diffuse.it)

---

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/3 "2008-04-11T16:27:27Z")

</div>

I am on shared server and don’t have access to apache onfig

---

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 4:25pm UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/4 "2008-04-11T16:25:02Z")

</div>

Hi Akira,

Below is my .htaccess . I pretty much used what was generated by  
rails.

# General Apache options

AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI

# If you don’t want Rails to look in certain directories,

# use the following rewrite rules so that Apache won’t rewrite certain

requests

# 

# Example:

# RewriteCond %{REQUEST\_URI} ^/notrails.\*

# RewriteRule .\* - [L]

# Redirect all requests not available on the filesystem to Rails

# By default the cgi dispatcher is used which is very slow

# 

# For better performance replace the dispatcher with the fastcgi one

# 

# Example:

# RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]

RewriteEngine On

# If your Rails application is accessed via an Alias directive,

# then you MUST also set the RewriteBase in this htaccess file.

# 

# Example:

# Alias /myrailsapp /path/to/myrailsapp/public

# RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
#RewriteRule ^(._)$ dispatch.cgi [QSA,L]  
RewriteRule ^(._)$ dispatch.fcgi [E=X-HTTP\_AUTHORIZATION:%  
{HTTP:Authorization},QSA,L]

# In case Rails experiences terminal errors

# Instead of displaying this message you can supply a file here which

will be rendered instead

# 

# Example:

# ErrorDocument 500 /500.html

ErrorDocument 500 “

## Application error
Rails application failed  
to start properly”

---

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 6:22pm UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/5 "2008-04-11T18:22:17Z")

</div>

Mongdar wrote:

> Hi Akira,
> 
> Below is my .htaccess . I pretty much used what was generated by  
> rails.
> 
> # General Apache options
> 
> AddHandler fastcgi-script .fcgi  
> cut

looks all fine to me. must be some apache config then. i think you have  
to ask your hosting provider.

---

<div class="post-metadata">

**Author:** ![Mongdar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@Mongdar](https://www.ruby-forum.com/u/Mongdar)\
**Post date:** [April 11, 2008, 9:07pm UTC](https://www.ruby-forum.com/t/request-routing-plugin-and-subdomain-share-process/134476/6 "2008-04-11T21:07:05Z")

</div>

ic. thank you!!!
