Request routing plugin and subdomain share process

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!

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/
ProxyPassReverse / http://127.0.0.1:9000/
and every request hits a mongrel and thus the app.

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

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

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”

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.

ic. thank you!!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs