Closed disciple-dev closed 8 years ago
Hi @iwritesomecode, Is this not possible by adding a custom middleware ? If not any idea on how it can work in Trails ?
It is possible for some things, but middleware are run on every request, which isn't ideal. I don't want to be setting trust proxy
on every request!
In the case of this module, I'm not sure what best practice would be. This hack works, but it's about the most painless way I found of doing it without changing this trailpack:
in myProject/server.js
:
server.start()
.then(app => app.packs.express.server.disable('x-powered-by'))
.catch(err => server.stop(err))
Obviously not ideal.
I'm not sure the best way to get around to implementing it; I'll have a whack at it this weekend, perhaps. Since the express app is intialized by the trailpack, the trailpack could look for extra options in config/web.js
without affecting any parent classes, I think.
Ok I'll look at this, make sense to have kind of init
method available into config/web.js
that can be use for this kind of stuff.
Thanks for the explanation :)
I think an init method in config/web.js
is a nice idea.
Alive in v1.1.0 guys :)
It would be nice to be able to set a few more options with express than seems to be possible, now.
I could be completely missing this, but is there doesn't seem to be a way to do something like
app.disable()
orapp.enable()
, say if you wanted to disableX-Powered-By
or enabletrust proxy
There's a few ways to work around this, but It would be handy.