Apache RequestHeaders for Software-As-a-Service under Rails -
Multiple client examples under one application, under the same application.
What do I want to connect to my Apache web server, like the user passing by different URLs like: customer1.myhost.com company1.myhost.com company2.myhost.com etc.
What do I want to do to my Apache server Request DirectHeader to identify the requested host on current requests (like trac.myhost.com and), did not direct to a specific list of my Rail applications Pass all requests made to:
RequestHeader "INSTANCE_NAME" = customer1 # for customer1.myhost.com
Thank you for your help!
P: The end goal is to provide software slices as a service, but all of them are managed under client 1 application running. There is no 1 app per customer. By using standard virtualhost configuration, you can:
Partitioning Host *: 80 & lt; VirtualHost *: 80 & gt; ServerName app.example.com ServerAlias * .example.com DocumentRoot /web/app.example.com/public & lt; / VirtualHost & gt;
This will capture all requests that have not already been captured by other virtualhost entries.
When your application receives the request, you will have the request variable set with the host -name provided. It is available for any action controller:
request.host
From there you can load the appropriate data in the first_filter, as is usually Used on:
before_filter: load_client def load_client @client = Client.find_by_hostname! (Request.host) Rescue ActiveRecord :: RecordNotFound Render (: partial = & gt; 'client_not_found' ,: position =>:
Unless the host's hostname is populated correctly Yes, it will be available on every page load.
Comments
Post a Comment