From 7b6c56a73bf10f02cd616dd52a30721635d71429 Mon Sep 17 00:00:00 2001 From: Mjumbe Poe Date: Wed, 4 Jan 2012 04:18:51 -0500 Subject: [PATCH] Only set the script_prefix if the prefix isn't already a full URL. --- djangorestframework/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/djangorestframework/views.py b/djangorestframework/views.py index 4cc2c7cb0..4606e50b1 100644 --- a/djangorestframework/views.py +++ b/djangorestframework/views.py @@ -115,8 +115,9 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): # Calls to 'reverse' will not be fully qualified unless we set the scheme/host/port here. orig_prefix = get_script_prefix() - prefix = '%s://%s' % (request.is_secure() and 'https' or 'http', request.get_host()) - set_script_prefix(prefix + orig_prefix) + if not (orig_prefix.startswith('http:') or orig_prefix.startswith('https:')): + prefix = '%s://%s' % (request.is_secure() and 'https' or 'http', request.get_host()) + set_script_prefix(prefix + orig_prefix) try: self.initial(request, *args, **kwargs)