Hi,
I'm trying to use OpenResty as a proxy authentication.
My authentication service will post back to the proxy with user information.
Here is the workflow.
It broke at the 5th step.
...
...
cookie:set({key = "x_uid", value = val, max_age = 14400, path = "/"})
...
cookie:set({key = "x_user_roles", value = val, max_age = 14400, path = "/"})
...
...
}
# Pass the request to Kibana
proxy_pass http://localhost:5601/;
proxy_redirect off;
proxy_method GET;
proxy_set_header x-forwarded-for 10.0.0.1;
proxy_set_header x-proxy-user $cookie_x_uid;
proxy_set_header x-proxy-roles $cookie_x_user_roles;
In the proxy pass step, the cookie values are empty. The Kibana will ask for a credential.
I tried with to comment out proxy_* settings and use ngx.say to return HTTP OK status.
Then, enable proxy_* settings again. It works because the cookies has been set on the browser.
How can we flush the cookie values to the browser before the response end?
Regards,
Worapoj