After working a new project for awhile (I’m working with PHP and Java). As a quick background story, I’m using Symfony2 and Guzzle to make my calls to my Java webservices. This was working out great except for one minor issue. Well, minor if you count not being able to call my REST services through Guzzle. My problem was that IIS is running my PHP application on port 80 while my Glassfish REST services were running on port 8080 (the Glassfish default). I needed to set up my applications forward requests to Glassfish. So I’ll quickly guide you how to set this up. This will work for any application server, not just Glassfish.
- Make sure you have Glassfish and IIS installed. I’m using Glassfish 3.1.2 and IIS 7.5. Any other versions should work with a few modifications. You can download the latest version of Glassfish here http://glassfish.java.net/ and all your latest IIS needs can probably be found here http://www.iis.net/.
- Download Microsoft Web Platform Installer 3.0. You can find a download here http://www.microsoft.com/web/downloads/platform.aspx. After you’ve finished your download install it.
- After you’ve install Microsoft Web Platform Installer 3.0 you need to install Web Farm Framework. To do this launch IIS (Click start, run, then type IIS).
- You should see Web Platform Installer installed in the bottom pane of IIS. Double click on it and then do a search for Web Farm Framework.

- Click add and then Install. You might have a few other components that need to be installed. Go ahead and click accept.

- Woohoo that was awfully easy. Now navigate to the main screen of IIS. You should have a Server Farms node. Click on Create Server Farm in the right panel.

- Enter the name of the server farm and click next. Click finish without adding a server. Click yes to add routing rules for the server.
- Select Servers then click Add Servers on the right pane.

- Enter the IP address or server name of the server you’re adding to the farm. In my case this is localhost. Click on Add and this will add the server to your farm.
- Click on Advanced settings and select the server you’ve added. You should see the ports that you can assign to your server. Enter your port number for HTTP and HTTPS. I’m entering 8080 because that’s what my Glassfish Server is running on.

- Great we’re almost there. All we have to do now is set up some routing rules. I only want certain URLs getting routed to Glassfish. Select your server farm and then double click on Routing Rules.

- Now just add the rules you want to exclude. Everything else will be forwarded. I don’t want any PHP extensions forwarded nor do I want anything that’s URL contains app_dev.php (Development purposes with PHP). My rules look like this.

- You’re all set! Now you can hit your Glassfish URL’s without entering the port. This fixed one of the issues I was having with Guzzle.
Now that we’ve set this up I’ll show you how to set up Symfony2 and Guzzle so you can start writing a PHP application that makes REST calls.
Could you please help me.
I’m trying your tutorial as you said it but it’s still not working.
Glassfish is running on port 8080 i.e. http://localhost:8080/myProject/index.jsp
and iis is running on port 80.
And the url I need to call is http://localhost/myProject/index.jsp. that url needs to get that data from glassfish.
Please help, I really need this.
If you’ve followed the tutorial it should be working. Please note that in your case you do not need any rewrite rules. IIS reroutes everything by default so only add what should not be redirected. I hope that helps.
Thanks for the reply,
i’ve added the server farm, and a server “localhost” which listens on port 8080 for http.
But as soon as i request http://localhost/myProject/index.jsp i get a timeout. Any reason why this would happen?
Is that the correct url? Does http://localhost:8080/myProject/index.jsp work? That’s the first step. If you have directory navigation setup, that will be the easiest way to see if your URL is correct. If you’re still having trouble let me know your gchat name and I’ll step you through evertying.
Yes, http://localhost:8080/myProject/index.jsp does work. That’s how i’ve been testing my web application. But now my company requested that we try and use iis with glassfish to not use up more IP’s. I’m at home now, so I’ll quickly try again here.
Is there any compatibility issues with Windows 7?
Oh yea, and any problems with 64bit windows?
I sent you an invite for gchat. This was set up on Windows 7 with a 64 bit machine as well as a 32 bit machine with no issues.
What did you have to do to get the farm for 64 bit installed on windows 7? I have Win 7 pro, with IIS 7.5. Web platform installer 4.0 contains only server farm 1.1, not 2.X. I tried to install off the Microsoft site, and refused to install it.
Forget it, you have to use WPI 3.0 to get the latest server farms.