diff --git a/drupal/sites/all/modules/esi/esi.inc b/drupal/sites/all/modules/esi/esi.inc
index 9771d73..fa001c3 100644
--- a/esi/esi.inc
+++ b/esi/esi.inc
@@ -232,7 +232,7 @@ function esi_build_uri($path) {
 
   // If Use a CDN for AJAXed fragments is disabled then do not CDN path.
   if (!variable_get('esi_cdn_ajax', ESI_CDN_AJAX)) {
-    return base_path() . $path;
+    return url($path);
   }
 
   $original_path = $path;
@@ -269,5 +269,5 @@ function esi_build_uri($path) {
   }
 
   // If nothing was altered then use the drupal default.
-  return base_path() . $path;
+  return url($path);
 }
