Facing 502 error: with AWS CloudFront

Hello Folks,

I am using sefl hosted passbolt service. I amusing AWS community AMI, hosted on ec2 server. I have load balancer on it. and configured cloudfront for that and have domain which is pointing to cloudfront.
now when i am trying to hit the domain it is giving me 502 error. but when i remove cloudfront and route traffic directly to load balancer it is working fine. I have checked all the security groups and everything it seems fine.
If you faced same issue like this please help !!