I am using nginx-ingress in my cluster to expose certain services. I have an "auth" service that handles authentication, which I am trying to setup through nginx. Currently the service has a very simple GET endpoint, that always responds with a UserId
header and tries to set two cookies:
// This is implemented on Nest.js which uses express.js
@Get('*')
auth(@Res() res: Response): void {
res.header('UserId', '1')
res.cookie('key', 'value')
res.cookie('x', 'y')
res.status(200).send('hello')
}
I can confirm that both cookies are being set when I manually send a request to that endpoint, but when I set it as an annotation to the ingress:
nginx.ingress.kubernetes.io/auth-url: http://auth.dev.svc.cluster.local
and send a request through the ingress, only one of the cookies is forwarded to the Response (the first one key=value
). I am not familiar with the nginx configuration, is there something I am supposed to change to make this work, so that both cookies are set?
I found this issue on GitHub, but it seems to be about OAuth2 there is no clear explanation on what I am supposed to change.