Redirect with modified request

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?

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?

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

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.

loginsrv does that (GitHub - tarent/loginsrv: JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..).

This may help: loginsrv/redirect.go at master · tarent/loginsrv · GitHub

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

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