Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: daniel on November 10, 2010, 02:44:45 PM

Title: Subdomain redirection or multiple public IP addresses
Post by: daniel on November 10, 2010, 02:44:45 PM
Is it possible to set SME server running in server/gateway mode to redirect a subdomain to a separate machine behind the firewall?  Example:  Wan side www.domain.com:443 goes to the SME server.  Behind the SME server is machine2.domain.com running an app on port 443.  Is it possible that anytime machine2.domain.com:443 is requested from the wan side it forwards https to the actual machine2 behind the firewall instead of sending https to the sme server?

What about assigning two public IP addresses to the WAN side of the SME server and having all traffic from the second public IP address be forwarded to a separate internal machine?

Thanks in advance for any suggestions.
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: CharlieBrady on November 10, 2010, 03:20:44 PM
Is it possible to set SME server running in server/gateway mode to redirect a subdomain to a separate machine behind the firewall?

Search here for domain proxypass.
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: janet on November 10, 2010, 04:21:49 PM
daniel

SME only supports one public IP.
Click the FAQ link at top of forums for the other answer Charlie refers to.

You really should read the available documentation and learn to do searches as both questions have been answered here many many times.

Title: Re: Subdomain redirection or multiple public IP addresses
Post by: daniel on November 11, 2010, 12:47:20 AM
Yes I did find some of the information.  THanks.

After following the proxypass domain setup, I have SME passing wan traffic to the internal machine if its http.  If I try running the server-manager on the internal machine through the WAN I get the error the error "Your browser does not appear to support cookies or has cookies support disabled.  This site requires cookies - please turn cookie support on or try again using a different browser"  This happens in both IE and Firefox.  Does proxypass not transfer cookies?  I am able to get to the primary site on the internal machine via https.  I assume the SME server is passing port 443 correctly through to the internal machine. 

advice?
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: cactus on November 11, 2010, 10:40:28 AM
After following the proxypass domain setup, I have SME passing wan traffic to the internal machine if its http.  If I try running the server-manager on the internal machine through the WAN I get the error the error "Your browser does not appear to support cookies or has cookies support disabled.  This site requires cookies - please turn cookie support on or try again using a different browser"  This happens in both IE and Firefox.  Does proxypass not transfer cookies?  I am able to get to the primary site on the internal machine via https.  I assume the SME server is passing port 443 correctly through to the internal machine. 
I guess the cookie domain set in the cookie is not the same as the external domain the browser is seeing and hence the browser does not use the (proper) cookie. Perhaps you can adjust or modify the cookie domain?
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: CharlieBrady on November 11, 2010, 09:31:11 PM
I guess the cookie domain set in the cookie is not the same as the external domain the browser is seeing and hence the browser does not use the (proper) cookie. Perhaps you can adjust or modify the cookie domain?

The cookie domain is set by the login script of SME server server-manager. I don't think we should be asking end-users to modify that code.

I think cactus is right to think about the cookie domain as the likely issue. What external DNS name are you using, what is your proxypass target, and what is the domain configured on the target server? A mismatch somewhere along that path will cause the cookie to be ignored.

You should raise this issue in the bug tracker. There might be some simple change possible in the server-manager authentication system which will allow it to via a proxy pass.

Alternatively you might find some configuration on the server doing the proxying which will work. You want the FQDN at all three steps to match (external DNS, proxypass target and the domain configured on the target server). You might be able to do that via a custom entry in DNS or /etc/hosts on the server doing the proxying - it would need to resolve to the internal proxy target.
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: daniel on November 11, 2010, 10:46:48 PM
When doing
#db domains show server.charton-mgmt.biz 
I get the following:

server.charton-mgmt.biz=domain
Nameservers=internet
ProxyPassTarget=http://192.168.93.9/
TemplatePath=ProxyPassVirtualHosts

I followed this link in the wiki http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass

My main server is www.charton-mgmt.com, so this passes charton-mgmt.biz through to the internal machine at 192.168.93.9.

Title: Re: Subdomain redirection or multiple public IP addresses
Post by: janet on November 12, 2010, 01:28:41 AM
daniel

When I try to access https://server.charton-mgmt.biz/server-manager
I get
Bad Gateway
The proxy server received an invalid response from an upstream server.

I also get a certificate warning and I see your certificate is for
blackbox.charton-mgmt.com

Something is not right with your configuration.
Is the upstream server configured to accept that domain and does it have a web server running ?

https://charton-mgmt.biz
gives server cannot be found

I think your configuration is not correct.
Remove the proxy pass setting, remove the domain name for that domain and try again
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: daniel on November 12, 2010, 02:28:54 PM
Mary,

I only have the server up when I'm testing and developing, this is not a server that stays up.  Thats why you were unable to get to it.  I won't have it up till sometime later today when I go back to linux testing again.
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: CharlieBrady on November 12, 2010, 02:35:28 PM
When doing
#db domains show server.charton-mgmt.biz 
I get the following:

server.charton-mgmt.biz=domain
Nameservers=internet
ProxyPassTarget=http://192.168.93.9/
TemplatePath=ProxyPassVirtualHosts

Try:

ProxyPassTarget=http://server.charton-mgmt.biz/

and add '192.168.93.9 server.charton-mgmt.biz' to /etc/hosts on your gateway machine via a custom template.
Title: Re: Subdomain redirection or multiple public IP addresses
Post by: daniel on November 12, 2010, 05:51:09 PM
Thanks for the suggestion, I tried setting ProxyPassTarget to http://server.charton-mgmt.biz and the hosts file,  and from outside I still get the cookies problem when going to https://server.charton-mgmt.biz/server-manager.