Take the 2-minute tour ×

Now i have a public Wcf REST service A, and several internal wcf REST services B, each of internal services are identified by name. Is it possible to create a router/proxy in service A, and then, when the users request the interface of service A, it can redirect the request to the internal services based on name?

I tried using:

WebOperationContext.Current.OutgoingResponse.Location = targetInternalPath;
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Redirect; // or MovedPermanently

All works fine except the headers that we get on the client side, Here is the details from Fiddler:

In other words, the client knows the exact internal address, the content-type and content-length is incorrect. All are not what i want. I have been struggling with this issue for days, anybody has any idea?

Best Regards.


share|improve this question

2 Answers 2

I'm confused. What you are seeing in fiddler is exactly what you are asking it to do. Your service A is returning a redirect response. The client is supposed to respond to that redirect by following the URI in the Location header.

If you truly want to hide the internal services then you need to make the service A work like a proxy. It needs to make the request to the internal services itself and then return the response it gets back.

Are you trying to hide the internal services for security reasons or is it just the clients don't know about those internal servers in advance?

share|improve this answer
Hello,Thanks for your reply. I just want to redirect the requests accepted by service A to internal services based on service name. –  johnneyzhang Apr 1 '11 at 6:12

The WCF RoutingService functionality can't be used because it only supports soap-based bindings. You could use the IIS 7 URL Rewrite Module as suggested here by Matthias in the MSDN forum answer. You could configure it to redirect the calls to the internal REST based services (an overview of its use at this link). I'm not sure it will help re-write the response header contents but it's worth a look.

share|improve this answer
Thanks for your reply, I think the IIS 7 Rewrite Module is right for me, but my application is used for SDK, i don't want the customers to download additional setup. –  johnneyzhang Apr 1 '11 at 6:10

Your Answer


