diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php
index 4657fdf..ca26984 100644
--- a/core/lib/Drupal/Core/Routing/UrlGenerator.php
+++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php
@@ -183,7 +183,7 @@ public function generateFromRoute($name, $parameters = array(), $options = array
       }
     }
 
-    $base_url = $this->context->getBaseUrl();
+    $base_url = isset($options['base_url']) ? $options['base_url'] : $this->context->getBaseUrl();
     if (!$absolute || !$host = $this->context->getHost()) {
       return $base_url . $path . $fragment;
     }
diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
index e80e193..8df5b3a 100644
--- a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
@@ -134,6 +134,8 @@ public function getPathFromRoute($name, $parameters = array());
    *     defined, the current scheme is used, so the user stays on HTTP or HTTPS
    *     respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
    *     and FALSE enforces HTTP.
+   *   - 'base_url': Only used internally, to modify the base URL when a language
+   *     dependent URL requires so.
    *   - 'prefix': Only used internally, to modify the path when a language
    *     dependent URL requires so.
    *
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index 7404372..b22a0bb 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -259,6 +259,24 @@ public function testAbsoluteURLGeneration() {
   }
 
   /**
+   * Confirms that explicitly setting the base_url works with generated routes
+   */
+  public function testBaseURLGeneration() {
+    $options = array('base_url' => 'http://www.example.com:8888');
+    $url = $this->generator->generateFromRoute('test_1', array(), $options);
+    $this->assertEquals('http://www.example.com:8888/hello/world', $url);
+
+    $this->routeProcessorManager->expects($this->once())
+      ->method('processOutbound')
+      ->with($this->anything());
+
+    $options = array('base_url' => 'http://www.example.com:8888', 'fragment' => 'top');
+    // Extra parameters should appear in the query string.
+    $url = $this->generator->generateFromRoute('test_1', array('zoo' => '5'), $options);
+    $this->assertEquals('http://www.example.com:8888/hello/world?zoo=5#top', $url);
+  }
+
+  /**
    * Test that the 'scheme' route requirement is respected during url generation.
    */
   public function testUrlGenerationWithHttpsRequirement() {
