Core: How to add global Customs Headers?

Created on 7 Dec 2017  路  5Comments  路  Source: adonisjs/core

Hi, i need add global custom headers, in specific: 'Strict-Transport-Security'.

My API AdonisJS is upload with pm2

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

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

milosdakic picture milosdakic  路  3Comments

GianCastle picture GianCastle  路  3Comments

krunaldodiya picture krunaldodiya  路  3Comments

itsg2jakhmola picture itsg2jakhmola  路  3Comments

aligoren picture aligoren  路  4Comments