Problem with admin.js connexion on Heroku and express app (reverse proxy + cookie: secure)

26 views Asked by At

I have an app that runs on Heroku on which the connexion on admin.js does not work anymore:

The problem is that I added dynos in Heroku and Heroku has added a reverse proxy to my app. On the config for adminjs we use secure cookie and I know the problem come from the interaction of the reverse proxy with the secure cookie. in the config for Adminjs I use buildAuthenticatedRouter and I have those settings

  resave: true,
  saveUninitialized: true,
  proxy: NODE_ENV === 'production',
  cookie: {
    httpOnly: NODE_ENV === 'production',
    secure: NODE_ENV === 'production'
  }

in my app.js file I have

if (NODE_ENV === 'production') app.enable('trust proxy', true)

I thought the proxy: NODE_ENV === 'production' and app.enable('trust proxy', true) would change something but no it doesn't

Thank you for your help

0

There are 0 answers