2

I have a problem with express session, connect-mongo and Amazon Beanstalk.

Each time that Amazon Beanstalk wants to check health, It's doing a request to API but it creates a new document in mongodb database. So, in a short time Amazon creates 200.000 new documents with session that doesn't serve.

Is there way that I can ignore thats requests?

Thanks.

slorenzo
  • 3,386
  • 2
  • 27
  • 44
  • 1
    I would look at the answers to this question: http://stackoverflow.com/questions/12921658/use-specific-middleware-in-express-for-all-paths-except-a-specific-one In general I think you will want to setup a health-check endpoint that doesn't invoke the session creation middleware. – Mark B Dec 06 '16 at 15:47
  • Thanks! You put me in the right direction. I found this answers: http://stackoverflow.com/a/22882673/1741027 ... I believe that it is the answer for my problem. – slorenzo Dec 06 '16 at 17:36
  • Yeah that's exactly what you need, glad I could help and sorry I couldn't come up with the full answer directly. – Mark B Dec 06 '16 at 17:50

1 Answers1

0

I had this EXACT same problem, and just posted a solution here in case anyone is still having the same problem. Hope this helps! https://stackoverflow.com/a/47850419/1791845

Ryan
  • 709
  • 6
  • 7