﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24967	FORCE_SCRIPT_NAME causes HttpResponseRedirect to fail	Sean Herron	nobody	"When FORCE_SCRIPT_NAME is set in settings, redirects using HttpResponseRedirect seem to fail.

'''Expected behavior:'''
While FORCE_SCRIPT_NAME is enabled (set to `foo`), HttpResponseRedirect should return the user to a correct path, prepended with the script name. (eg, `/foo/bar`).

'''Actual behavior:'''
HttpResponseRedirect doubles the script name and redirects the user to `/foo/foo/bar`.


As a workaround, I created a utility function to reconstruct a full URL to redirect the user to, but this should not be necessary.


{{{
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.conf import settings

def absolute_redirect(url, args=None):
    """"""
    This is a function that I needed to make because
    Django's default redirect function doesn't work properly when
    FORCE_SCRIPT_NAME is set. It returns a full URL for redirection
    """"""
    
    reverse_url = reverse(url, args=args)

    if settings.URL_ROOT:
        reverse_url = reverse(url, args=args)
        return redirect('%s%s' % (settings.URL_ROOT, reverse_url))
    else:
        return redirect(reverse_url)
}}}


"	Bug	closed	Core (URLs)	1.8	Normal	invalid	SCRIPT_NAME, FORCE_SCRIPT_NAME,redirect,HttpResponseRedirect		Unreviewed	0	0	0	0	0	0
