I was trying to log the user-name in the nginx logs. As I am not doing basic http authentication, adding $remote_user in log_format doesn't work. I will need my application to tell Nginx what the current username is. And to do this I need to add a response header. Can someone please tell me how to add extra header using middleware module and finally use it log_format directive?