public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Kazantsev <mike_kazantsev@fraggod.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] A networking question...
Date: Wed, 6 May 2009 06:24:08 +0600	[thread overview]
Message-ID: <20090506062408.7b03652d@coercion> (raw)
In-Reply-To: <4A00AF76.9010509@shic.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

On Tue, 05 May 2009 22:28:22 +0100
Steve <gentoo_sjh@shic.co.uk> wrote:

> Sascha Hlusiak wrote:
> > The easiest thing would probably be to just use ssh port forwarding because 
> > you already have all the pieces running anyway. Wouldn't a simple
> >
> >   ssh -L 12345:secondapache:https user@remotessh
...
> I really want to avoid having to access a non-standard port from the 
> URLs - I want to use the final URLs exactly as they will be once the 
> in-development website is eventually deployed.

But you don't have to!
Just setup first apache to forward requests to the second one in any
way you like using mod_rewrite:

  RewriteRule /remote/(.*) http://localhost:1235/$1 [P]

The rule might need some correction, but it's here just to illustrate
the point. That way you can bind any number of "remote" servers to
local urls, served (in the end) by the same apache.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Also I think it's worth mentioning that apache isn't well suited for
such a tasks if both local and remote targets get similar load - lite
frontend server or reverse proxy (like nginx, lighttpd, squid, haproxy
etc) should save a lot of workload.
Even more, if you'll make it serve static content as well, and
optimally get apache out of the equation at all ;)

Another point is that apache isn't any good at mangling http headers as
well, so you should make sure that remote scripts won't redirect user
to 'localhost:12345' or use HTTP_HOST var from CGI interface (since
it'd be set to the same localhost), using *_X_* vars instead.
Alternative is, again, to install something that can mangle headers
and that's any of the daemons mentioned above.

-- 
Mike Kazantsev // fraggod.net

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2009-05-06  0:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-05 20:32 [gentoo-user] A networking question Steve
2009-05-05 21:23 ` Sascha Hlusiak
2009-05-05 21:28   ` Steve
2009-05-05 21:51     ` Sascha Hlusiak
2009-05-05 22:07       ` Mick
2009-05-06  0:24     ` Mike Kazantsev [this message]
2009-05-06  7:54       ` Neil Bothwick
2009-05-06 10:09         ` Anthony Metcalf
2009-05-06 10:42           ` Neil Bothwick
2009-05-06 12:08             ` Anthony Metcalf
2009-05-07 18:38               ` Steve
2009-05-07 22:34                 ` Mick
2009-05-08 12:38                   ` Steve
2009-05-08 14:43                     ` Mick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090506062408.7b03652d@coercion \
    --to=mike_kazantsev@fraggod.net \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox