Membership redirect to custom Thank You page is not working

I have set up a custom page as Thank-You page in Membership 2 Pro General settings, but after I fill out the information to register for a membership I’m not redirected to any page and I’m getting a 502 error instead.

I tried running a plugin/theme conflict test and I have found that the issue is not there if switching to Twenty Seventeen theme. I’m using the Impreza theme on my site.