Managed wordpress site too many redirects

when i switch from flexible the error changes from too many redirects to error 502 (bad gateway)