Merge pull request #537 from MITx/feature/cale/xqueue_callback_url_proto

Pull the http or https from the forwarded proto for the xqueue callback ...
This commit is contained in:
Calen Pennington
2012-08-23 08:51:54 -07:00

View File

@@ -199,7 +199,10 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
)
# Fully qualified callback URL for external queueing system
xqueue_callback_url = request.build_absolute_uri('/')[:-1] # Trailing slash provided by reverse
xqueue_callback_url = '{proto}://{host}'.format(
host=request.get_host(),
proto=request.META.get('HTTP_X_FORWARDED_PROTO', 'https' if request.is_secure() else 'http')
)
xqueue_callback_url += reverse('xqueue_callback',
kwargs=dict(course_id=course_id,
userid=str(user.id),