502 Bad gateway error when submitting a form