Mediawiki redirect issue when nginx is behind varnish and listen to not 80


I hava migrated a mediawiki site to nginx server.Nginx listen to port 81
and is behind Varnish listen to 80.Varnish and Nginx on same
like the configuration used for the Nginx wiki have a redirect
issue.Visit index page will redirect to example:81.

Any ideas?