Wrong Domain-Name using Apache as Reverse Proxy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong Domain-Name using Apache as Reverse Proxy

Adrian Schmitt
Hi!

Now I got finally running seaside behind an apache-1.3-reverse-proxy..
(was not too hard)

But there is a problem now.. I get the wrong links. The links I am
seeing on the site have the domain of the server where the image is
running.. but they need to have the domain of the server where apache
is running.

The links in the site look like this:

a href="http://10.233.200.2/seaside/store"

10.233.200.2 is the address of the machine where the image is running
(as seen from the webserver where the apache reverse-proxy is running)

Should be like this:

a href="http://mybeautifuldomain.com/seaside/store"

Can I tell seaside to use another domain to construct the links?

Thank you
Adrian
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Wrong Domain-Name using Apache as Reverse Proxy

Boris Popov, DeepCove Labs (SNN)
<Location /online>
 Order deny, allow
 Allow from all
 # Proxy all requests to /online down to the actual host running Seaside
 ProxyRequests Off
 ProxyPreserveHost On
 ProxyPass http://192.168.0.2:8008/online
 ProxyPassReverse http://192.168.0.2:8008/online
</Location>

That works for me, although you can just set the server hostname in the
application properties as well if you can't figure out Apache's side of
things,

(self registerAsApplication: 'online')
  preferenceAt: #serverHostname put: 'www.mybeautifuldomain.com';
  yourself

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Adrian
Schmitt
Sent: Monday, January 29, 2007 1:32 PM
To: [hidden email]
Subject: [Seaside] Wrong Domain-Name using Apache as Reverse Proxy

Hi!

Now I got finally running seaside behind an apache-1.3-reverse-proxy..
(was not too hard)

But there is a problem now.. I get the wrong links. The links I am
seeing on the site have the domain of the server where the image is
running.. but they need to have the domain of the server where apache
is running.

The links in the site look like this:

a href="http://10.233.200.2/seaside/store"

10.233.200.2 is the address of the machine where the image is running
(as seen from the webserver where the apache reverse-proxy is running)

Should be like this:

a href="http://mybeautifuldomain.com/seaside/store"

Can I tell seaside to use another domain to construct the links?

Thank you
Adrian
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Wrong Domain-Name using Apache as Reverse Proxy

Tibbe David
Hi,

Another idea is to use modules like mod_proxy_html or mod_line_edit.
These modules allow to rewrite code within the passed pages, even in
static JavaScript or CSS-Files.

We're using mod_line_edit in a similar scenario and it works fine.
Mod_proxy_html has replaced wrong parts when there were two replacements
within a script-tag.

Regards,
  David
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Wrong Domain-Name using Apache as Reverse Proxy

Avi Bryant-2
In reply to this post by Boris Popov, DeepCove Labs (SNN)
On 1/29/07, Boris Popov <[hidden email]> wrote:

>  ProxyPreserveHost On

That's the key line here, but it only works on Apache 2.x.  I'd
recommend you upgrade to that from 1.3 if at all possible...

Cheers,
Avi
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Wrong Domain-Name using Apache as Reverse Proxy

Adrian Schmitt
> On 1/29/07, Boris Popov <[hidden email]> wrote:
> >  ProxyPreserveHost On

2007/1/30, Avi Bryant <[hidden email]>:
> That's the key line here, but it only works on Apache 2.x.  I'd
> recommend you upgrade to that from 1.3 if at all possible...

Will upgrade to 2.x in the near future yes.

For now I simply entered the desired hostname 2 times in the
Web-Interface (Configure - Server - "Resource Base Url" and "Server
Hostname")  and it does what was needed.

I was curious and read in an apache 2.x book:

"ProxyPreserveHost On  passes the host-header of the request to the
remote server"
(This is exactly what I was looking for)

And: "this is normally only useful in configurations when name-based
virtual hosts are used"
(This is what I am doing here)

Thank you all for your help.I keep learning so much here.

Cheers
Adrian
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Wrong Domain-Name using Apache as Reverse Proxy

Adrian Schmitt
In reply to this post by Tibbe David
2007/1/30, Tibbe David <[hidden email]>:
> Another idea is to use modules like mod_proxy_html or mod_line_edit.
> These modules allow to rewrite code within the passed pages, even in
> static JavaScript or CSS-Files.

Did not know mod_line_edit exists. Very Interesting stuff! For now I
solved it changing
the seaside config.

I imagine mod_line_edit adds some overhead, which in my case can be
avoided. Because if seaside inserts the correct hostname from the
beginning (being told so in it's config or by the apache
request-header) it is not necessary to change it back.

Cheers
Adrian
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside