[Grok-dev] Running a grok app on paster on subdomains
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Jan 11 08:08:24 UTC 2012
On 1/10/12 5:12 PM, Matt Rutherford wrote:
> I have a domain example.com <http://example.com> that runs on a vanilla
> http server. I will have multiple subdomains whose DNS records will, for
> now, point to the same paster instance running a different grok app for
> each.
>
> How do I go about changing grok (or paster for that matter) to respond
> to request at a subdomain level instead of the usual virtual folder?
>
> So say I have my grok app serving at grokapp1.example.com
> <http://grokapp1.example.com>, by default it will be reached by hitting
> grokapp1.example.com/grokapp1 <http://grokapp1.example.com/grokapp1> or
> grokapp1.example.com/grokapp2 <http://grokapp1.example.com/grokapp2>.
> What I want to happen is requests for grokapp1 come to
> grokapp1.example.com <http://grokapp1.example.com> and grokapp2
> similarly to grokapp2.example.com <http://grokapp2.example.com>,
> dropping the need for the directory in the url.
>
> Is there a way to do this?
Usually this done by having a "frontend" http server in front of your
paster instance. This will make these kind of thing far easier and flexible.
For the applications we deploy we use Apache and its powerful rewrite
rules, proxying requests to application objects in the Grok "backend"
server (running on some private port, not directly accessible from
internet).
An example for such a rewrite rule could be like this (broken over two
lines):
RewriteRule /app1(.*) http://127.0.0.1:8080
/app1/++vh++https:app1.example.com:80/++$1 [P]
This uses Grok's feature for computing correct URLs based on the
information passed in the ++vh++ segments in the URL-prxoied-to.
HTH
regards, jw
More information about the Grok-dev
mailing list