1

I have a use case that goes like this:

1- A user logs-in to a FIRST server (via a web form of some sort).
2- This FIRST server establishes the user connection.
3- The FIRST server sends a URL redirection to the user.
4- The user's browser will point to SECOND server.

This is where it's not clear if what's in my head is actually feasible.

Can the browser redirection send a payload in a HTTP POST/GET to the redirected URL? Let's say:

5- SECOND server recieves POST in servlet to process the payload
public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    ...
}

What is actually going on, is I have 2 servers. FIRST establishes the connections and sends back a token (with security assessment, user info, and stuff). This token needs to be forwarded somehow to SECOND which will parse this token (an XML stream) to get to "know" the user.

I'm I completly insane?

Thx.

1 Answer 1

3

It depends which kind of redirect you are doing. If you just use a "location" header, you will only be able to pass a GET payload.

Now, in order to send more data you need to write a temporary page (that may be blank) with a <Form> (that may be hidden) that point to the 2nd server and that will auto submit itself automatically (using Javascript for instance). The said form will be able to POST any data to the 2nd server.

Please consider the security issues while sending tokens from one server to another and make sure people can't guess or copy those tokens, or that the two servers communicate through another way to make sure all clients are legit.

1
  • Ok, thanks for the insight. I've been asked to produce "something" that will receive a Token, and that I can parse it. I'm pretty sure it will be via URL redirect or POST, but with a redirect I'll need the token payload anyway, hence a POST.
    – code-gijoe
    Mar 2, 2011 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.