Re: Remote portforwarding and virtualhost



Logu wrote:
I have a machine with a public IP. I want to remote
portforward one of the webserver port (80) to this machine.
The webserver is apache with 5 virualhosts. If I forward the
connection to the public IP machine, I am not able to get the
corresponding webpages from the virtualhosts. Instead I am
getting all from one virtualhost. Is there a way to
distinguish the virtualhost while forwarding. ?

There is no problem with the apache configuration as I am
getting the correct pages from the localnetwork.

ssh -g -R 8080:v1.local.com:80 publicIP
ssh -g -R 8081:v2.local.com:80 publicIP
ssh -g -R 8082:v3.local.com:80 publicIP

What kind of virtual hosts are you using?

I am using Name based virtual host (ie., v1.local.com, v2.local.com and v3.local.com resolve to same IP).

SSH port forwarding is purely at the TCP layer, whereas HTTP name-based virtualhosts are implemented at the application layer.

For this to work, the HTTP client needs to send the virtualhost name to the tunnel. One way to do this would be to put entries for "v[1-3].local.com" into the HTTP client's hosts file pointing to publicIP (which also means you can make do with only one port forward).

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.



Relevant Pages

  • Remote portforwarding and virtualhost
    ... I want to remote portforward one of the ... webserver port to this machine. ... getting all from one virtualhost. ... There is no problem with the apache configuration as I am getting the ...
    (SSH)
  • Re: Remote portforwarding and virtualhost
    ... portforward one of the webserver port to this machine. ... The webserver is apache with 5 virualhosts. ... connection to the public IP machine, I am not able to get the ... distinguish the virtualhost while forwarding. ...
    (SSH)
  • RE: Remote portforwarding and virtualhost
    ... portforward one of the webserver port to this machine. ... The webserver is apache with 5 virualhosts. ... connection to the public IP machine, I am not able to get the ... distinguish the virtualhost while forwarding. ...
    (SSH)
  • RE: Apache Virtual Host
    ... you can also put an Include directive in the VirtualHost block. ... Subject: Apache Virtual Host ... have to load your default server as a vhost as well or you won't be able to ...
    (RedHat)
  • Re: [users@httpd] Re: cgi-bin stopped working in apache ?! please help SOLVED
    ... so now, when Apache starts, it "includes" the configuration of your new ... (It is the new default because it is now the first defined virtual host in ... terms to ServerAlias and that is what screwed me up. ... So whenever a Virtual Host "needs" a parameter value, and it is not explicitly defined in his own <VirtualHost> section, it will use the default parameter value as defined before the "NameVirtualHost" line. ...
    (Debian-User)