Access different apache servers using a single port number - apache

I have three different web servers in my internal lab and each one of them have its own database and web content. How can I access each one of them from the internet without mapping a different port on my firewall for each one of them?
In other words, can I set up a fourth apache server that checks when aconnection comes http://mydomain.com/WebServer1 to it sends the user to my server one on my internal network and http://mydomain.com/WebServer2, it redirect him to server 2 without having to open a port for the other 3 servers only for the main web server? I have attached a diagram to show my set up.
Thanks in advance

Related

IIS 10 ARR LoadBalancer Working more like Redundent Web Servers

We have configured a new webfarm using IIS10 with 3 hosts operating with the web traffic with a loadbalancing IIS ARR3.0 server sitting infront to balance incoming requests between all the nodes. During initial testing (Basic HTML pages) the round robin setup (33.33%) distribution between each node was working well but we had to enable server / client affinity so that our applications kept a consistent connection between our client session and the application. Since then, we are finding that all traffic going to these applications originating from different machines on different networks are all being forwarded to the same application server. If you take the server offline the application seamlessly starts running on the next server in the list (Client obviously must sign in again). Whilst one server is fine at this time to run the two applications we have running when we ramp up our migration and have all our 140 applications running, I don’t think one server will be too happy with the load.
ADDITIONAL INFORMATION
LoadBalancers/Arr Servers: LB-01 (LB-02 DUPLICATED Server for redundancy). Default ARR URL ReWrite with Route to Server Farm Action. Image of LB/ARR URL ReWrite Rule Server Affinity Enabled Client Affinity enabled use hostname selected no Advanced Settings, no routing rules. ARR Default Proxy Settings Image of Proxy Settings
Web/Application Servers WEB-01, WEB-02, WEB-03 FileSystem Shared using DFS All running on Shared Config's
The Applications would be as follows
https://www.domainname.com/application-name1
https://www.domainname.com/application-name2
...
Were the application launch page changes but the domain name stays the same
Image of IIS Monitoring and Management Window showing distribution
If there is a setting you wish to verify please ask for them. I know people arent physchic but huge paragraphs of information never really help.
My hunch is it is something to do with the URL rewrite I have tried the settings in the below post to no avail.
IIS ARR & load balancing
Uncheck 'Host Name Affinity' to dispatch to all your hosts

Using external IP (Networking) (Apache)

I'm setting up a tool that relays and verifies information. One of it's protocols though is to verify if the server trying to challenge a key is whitelisted.
Problem now is server 1 and 2 is in the same network. When I make server 1 connect to (somedomain.com), which is routed back to server 2. Server 2 recognizes remote address as the (local ip) not the public IP. (Even if I explicitly ask server 1 to connect using IP instead of Domain name.)
This creates problems as (Long story) but server 2 needs to recognize server 1's public IP and not Internal IP.
Would appreciate any help or tips I can get from this.
Cheers,
Jet
You can route traffic via external server using SSH or proxy.

Browsing two sites on the same IIS server

I uploaded two websites on a single IIS local server. One that hosts a WFC service other that consumes it
I know that using host header to distinguish them in not an option without a DNS server, so I gave the first one an all assigned IP ad the second one 172.20.1.44, whenever I try to browse to it locally it gives me the connection timed out
how could I browse to the second site on my local machine to test it
Put them on different ports. Put one site on * 80 and the other on * 8080. You can modify the port in the binding screen of IIS.

Tomcat Sharing cookie between two application on same server with different host name

I have two applications running on a single tomcat instance.
Both applications use some apache trickery to mask their IP to a host name
rather that
http://123.123.123.123/appOne
http://123.123.123.123/appTwo
It is
http://appone.com/appOne
http://apptwo.com/appTwo
I want to share common information between the two applications but the browser is assuming they are different.
I have set the
cookie.setDomain("123.123.123.123")
cookie.setPath("/")
both
request.getLocalName()
request.getLocalAddr()
return appone.com
Is it possible to do this?
Unfortunately, you can not share information between two applications via cookie in your deployment.
A browser sees that you have two applications in different domains: appone.com and apptwo.com.
By design it will never send a cookie from one domain to another.
You can share a data between applications via a database.

Error with DOJO when using IP

Strange error with an Project using dojo:
if i call : http://localhost/project everything works like expected.
if i call : http://127.0.0.1/project everything works like expected.
if i call : http://192.168.2.1/project i get the following error (ONLY in IE6!):
"Bundle not found, locale.."
Any ideas?
Iam running Zend Server CE with PHP 5.2
if i add: 192.168.2.1 to "hosts" it works (windows)
Sounds like Zend server is performing some kind of virtual site support using the site name as a partial domain.
I can't say 100% if/how it is beacuse I don't use Zend, but I can explain the principle using Apache as an Example.
There are 3 ways in which a web site can be virtually hosted under a single web server application, this applies to most servers on the market today, Apache, IIS, nginx and many others.
It all boils down to one thing, giving one running server application instance the ability to host multiple individual websites.
The 3 methods of seperating sites are as follows:
By IP address : If you have multiple IP addresses (Usually -but not always beacuse you have multiple network interface cards) then you can tell your server application to listen to one IP for one site, another IP for another site and so on. If you browse to one IP you'll get one site, and likewise the other on the other IP.
By Port Number : If your using only one IP address, then you can bind to multiple port numbers, port 80 is generally the default for web servers, but by browsing to an address and pinning the port number on the end (http://mysite.com:99) you'll force the browser to use that port. You can then have multiple websites listening on different ports and select them manually at browse time as required.
By Host Name Header: This is by far the most common way of supporting multiple sites, all web servers that understand the HTTP/1.1 protocol have to obey a header field in the request that contains the host name, when a request comes in for EG: http://mysite,com/ then there will be an entry in the request header that looks like 'Host: mysite.com' the webserver can then use that to say, oh yes.. I know which one that is.. and it then selects and serves the correct website.
The problems start to arise however when you start to use IP addresses that generally cannot be resolved or have no DNS name, because the web server then doesn't know which hostname to tag it to.
As an example in Apache, if you set up a virtual host, then try to browse that server using just the IP address, you'll get the default server, which in many cases won't even be configured to respond correctly or display anything.
To compound this, going up to web application layer, many frameworks also do their own checks on hostnames and other variables passed to them by the web server, and many make decisions on how to operate based on this information.
If you've gotten to the default web application by IP address, then there's a high chance that the framework may get confused at being presented with an IP address as a host name.
As the OP noted, in many cases, you can add a name to your hosts file and use this as a poor man's DNS substitute, the file to modify can be found in the following locations:
c:\windows\system32\drivers\etc\ - on windows
and
/etc/
on Linux/Unix
The file is generally just called 'hosts' and is a plain text file. Adding a line like:
123.456.789.123 myserver
Will tie http://myserver/ to http://123.456.789.123/
If you can, and your doing a lot of web applications it may be worth setting up your own DNS server, most Linux distros will allow you to install 'Bind' and I do also believe there is a version available for windows too.
I'm not going to go into the pro's and cons of private DNS servers here, it's a whole other subject in itself, but if your likely to be doing a lot of additions to your hosts, then in the long run you'll find it a better option.