Redirect with modified request

(Md Mahfuzur Rahman) #1

Hi,
I am creating a plugin. When user tries to visit a website, I want to validate the user and then redirect back to the original domain once validated. I tried to set a Header in the request to indicate the user is validated and then http.Redirect using status code 302. But when I receive the request after redirecting, the Header field is not there. How can I achieve this?

(Matthew Fay) #2

Just to clarify, you had your server send a response header to the client alongside the redirect, and the problem is that the client didn’t return that header on subsequent requests?

(Md Mahfuzur Rahman) #3

Yes. I don’t see the header I set when I receive the request after redirect.

(Matthew Fay) #4

Unless the header in question is Cookie, I don’t believe any client would have cause to repeat a header back to the server after receiving it, unless it was programmed to do so.

(Magikstm) #5

loginsrv does that (https://github.com/tarent/loginsrv).

This may help: https://github.com/tarent/loginsrv/blob/master/login/redirect.go

(Md Mahfuzur Rahman) #6

But the line looks like it is updating the response header, not the request header.

(system) closed #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.