Skip to main content

How to pass remote user credentials through HttpUrlConnection

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2012-05-01

I have two servers [tomcat servers] in my application and both the servers have the support to authenticate its remote-users. I want to create the following setup in my application. Could you please if it is feasible to create following setup? If so, could you please let me know the ways to achieve it?

If a particular http request is sent from remote-user to Server1, then Server1 should forward the same request to Server2 with the user as remote-user instead of server-user account. Then Server1 will process the results obtained from Server2 and send the response to remote-user [browser].

I tried connecting server2 using HttpURLConnection() in server1 but it is sending the request to server2 with Server1-user account instead of remote-user account. Please let me know your suggestions.