I am new to Nginx and hope to get some help.
I want to extract certain data (certain fields set by my PHP scripts) from browser cookie in nginx so that I can log it. If possible, I want to do this just by modifying nginx configuration.
Any pointer/help would be greatly appreciated.
You can access cookie values by using the
$cookie_COOKIE_NAME_GOES_HERE
variable.See Nginx Documentation
If anyone is using the previous answer with several different cookies in the response the correct regex is:
or more general usage:
Here's an example to extract an HttpOnly cookie and pass it on to a RESTful api as an OAuth Bearer token: