Hi, i need add global custom headers, in specific: 'Strict-Transport-Security'.
My API AdonisJS is upload with pm2
Best to do this in your server software (nginx, apache) IMO. Otherwise you can create a global middleware and add it to the response object in there
Thanks, How do you receive the response from the controller to add the header from the middleware?
@blacktrue Middleware is hit before the controller, it receives a request and a response object which then get passed onto the next middleware, then eventually the controller
Thanks, I understood if I add a header in the middleware it remains globally. Now it works
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Best to do this in your server software (nginx, apache) IMO. Otherwise you can create a global middleware and add it to the response object in there