 core/includes/file.inc                              | 2 +-
 core/lib/Drupal/Core/StreamWrapper/PublicStream.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/includes/file.inc b/core/includes/file.inc
index b9c217b..9491b2e 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -216,7 +216,7 @@ function file_create_url($uri) {
       // If this is not a properly formatted stream, then it is a shipped file.
       // Therefore, return the urlencoded URI with the base URL prepended.
       $options = UrlHelper::parse($uri);
-      $path = $GLOBALS['base_url'] . '/' . UrlHelper::encodePath($options['path']);
+      $path = \Drupal::request()->getBasePath() . '/' . UrlHelper::encodePath($options['path']);
       // Append the query.
       if ($options['query']) {
         $path .= '?' . UrlHelper::buildQuery($options['query']);
diff --git a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php
index e88eb53..1937841 100644
--- a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php
@@ -74,7 +74,7 @@ public static function baseUrl() {
        return (string) $settings_base_url;
     }
     else {
-      return $GLOBALS['base_url'] . '/' . static::basePath();
+      return \Drupal::request()->getBasePath() . '/' . static::basePath();
     }
   }
 
