Clone HTTP request and redirect to another server at localhost

I have a servlet which I call from an ajax function. What I want to do is forward the same request (header, cookie, etc.) to a different url on localhost. I need to call a hidden php api (not publicly accessible apache2) which I want to call using the original php session (cookies and headers).

I'm sure there is an easy way to do this, but I haven't found anything easier than doing an HttpURLConnection and populating all the data on foot. Is this really the only option?

+3


source to share





All Articles