diff --git a/core/core.services.yml b/core/core.services.yml
index 9c3f606..b7fc960 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -489,7 +489,7 @@ services:
       - [setContext, ['@?router.request_context']]
   unrouted_url_assembler:
     class: Drupal\Core\Utility\UnroutedUrlAssembler
-    arguments: ['@request_stack', '@config.factory' ]
+    arguments: ['@request_stack', '@config.factory', '@settings' ]
   link_generator:
     class: Drupal\Core\Utility\LinkGenerator
     arguments: ['@url_generator', '@module_handler']
diff --git a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
index 08d0083..c3e4cd2 100644
--- a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
+++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php
@@ -10,6 +10,7 @@
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Site\Settings;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -27,17 +28,27 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
   protected $requestStack;
 
   /**
+   * Whether both secure and insecure session cookies can be used simultaneously.
+   *
+   * @var bool
+   */
+  protected $mixedModeSessions;
+
+  /**
    *  Constructs a new unroutedUrlAssembler object.
    *
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config
    *    The config factory.
    * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
    *   A request stack object.
+   * @param \Drupal\Core\Site\Settings $settings
+   *    The read only settings.
    */
-  public function __construct(RequestStack $request_stack, ConfigFactoryInterface $config) {
+  public function __construct(RequestStack $request_stack, ConfigFactoryInterface $config, Settings $settings) {
     $allowed_protocols = $config->get('system.filter')->get('protocols') ?: ['http', 'https'];
     UrlHelper::setAllowedProtocols($allowed_protocols);
     $this->requestStack = $request_stack;
+    $this->mixedModeSessions = $settings->get('mixed_mode_sessions', FALSE);
   }
 
   /**
@@ -104,7 +115,7 @@ protected function buildLocalUrl($uri, array $options = []) {
 
     if ($options['absolute']) {
       $current_base_url = $request->getSchemeAndHttpHost() . $current_base_path;
-      if (isset($options['https'])) {
+      if (isset($options['https']) && $this->mixedModeSessions) {
         if (!empty($options['https'])) {
           $base = str_replace('http://', 'https://', $current_base_url);
           $options['absolute'] = TRUE;
diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
index 03b3375..765a73c 100644
--- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
@@ -33,6 +33,13 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
   protected $configFactory;
 
   /**
+   * The mocked settings object.
+   *
+   * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $settings;
+
+  /**
    * The tested unrouted URL assembler.
    *
    * @var \Drupal\Core\Utility\UnroutedUrlAssembler
@@ -47,7 +54,8 @@ protected function setUp() {
 
     $this->requestStack = new RequestStack();
     $this->configFactory = $this->getConfigFactoryStub(['system.filter' => []]);
-    $this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->configFactory);
+    $this->settings = $this->getSettingsStub(['mixed_mode_sessions' => FALSE]);
+    $this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->configFactory, $this->settings);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index d37a040..fa8452d 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -148,6 +148,27 @@ public function getConfigStorageStub(array $configs) {
   }
 
   /**
+   * Returns a stub settings object that behaves according to the passed in
+   * array.
+   *
+   * Use this to generate a settings object that will return the desired values
+   * for the given settings.
+   *
+   * @param array $settings_map
+   *   An associative array of settings.  Defaults to an empty array.
+   *
+   * @return \PHPUnit_Framework_MockObject_MockBuilder
+   *   A MockBuilder object for the ConfigFactory with the desired return values.
+   */
+  public function getSettingsStub(array $settings_map = array()) {
+    $settings = $this->getMock('Drupal\Core\Site\Settings');
+    $settings->expects($this->any())
+      ->method('get')
+      ->will($this->returnValueMap($settings_map));
+    return $settings;
+  }
+
+  /**
    * Mocks a block with a block plugin.
    *
    * @param string $machine_name
