use Apache to redirect requests to Visual studio development server port

by Saurabh Gupta

I do not really know anything about setting up Apache and nor is this step to greater achievement of any sorts. I had a small issue. Make my XCODE iPhone project communicate with web-service hosted on my windows XP laptop. This is just a student laptop and never needed to install a full blown IIS 5. Mostly, for my development work my visual studio development server was enough.

Now, how do I get my visual studio development server to accept external requests? I needed this only for testing tonight. I googled and of course there is no direct way of doing it. You need a hosting server to start with. If I had IIS 5, I could use an application called “Trace Utility” for Microsoft Soap Toolkit version 3 to redirect requests for your visual studio development server port. Here’s Jim Wilson showing it, how? or if it is for windows 7 machine- here’s him showing it again, how?

But I needed this to work without IIS, so where do I go next? Apache Server 2.2

So I did following –

1. Installed Apache server 2.2 – http://httpd.apache.org/

2. Set up port number for my visual studio development server to run on – say 4452 – http://msdn.microsoft.com/en-us/library/ms178109(v=vs.80).aspx

3. Locate a file called – “httpd.conf”- Apache HTTP server configuration file. This should be in folder – “{installed directory}\Apache Software Foundation\Apache2.2\conf”

4. So as I read this file and tried to interpret the language it is trying to communicate with me with, I make few notes-

  1. lines starting with # are commented lines or to say server will ignore them
  2. One line says “Listen 80” – of course the port number which is default port number on which a TCP/IP server carries HTTP requests – http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
  3. Load various modules to be able to apply specific configuration

5. What I did –

  1. Uncommented the line – “LoadModule proxy_module modules/mod_proxy.so”
  2. Right when they start specifying the configuration directives, I included –

ProxyPass /MyService.svc http://localhost:4452/MyService.svc

6. What it did – redirected all my REST requests from XCODE iPhone simulator on my macbook to localhost:4452/MyService.svc

7. How I knew what am I doing – http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypass

Advertisements