502 Bad Gateway error shown when submitting form