diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
index 91f23b64334cf2a2103e0f4e876ff584784a5aec..6e16041c3a0fd8b9548b4c05a3421a7e70a5079e 100644
--- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php
+++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
@@ -159,4 +159,14 @@ class Sidebar extends AbstractCart
     {
         return $this->getUrl('customer/account/forgotpassword');
     }
+
+    /**
+     * Return base url.
+     *
+     * @return string
+     */
+    public function getBaseUrl()
+    {
+        return $this->_storeManager->getStore()->getBaseUrl();
+    }
 }
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
index 03322e3ab35958db5bbe99d179ad6f3fd5cec958..314e3038a0555a7d95715e8f27fbefd260c89e00 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml
@@ -49,23 +49,20 @@
             removeItemUrl: '<?=$block->getRemoveItemUrl()?>',
             imageTemplate: '<?= $block->getImageHtmlTemplate()?>',
             customerRegisterUrl: '<?= $block->getCustomerRegisterUrlUrl()?>',
-            customerForgotPasswordUrl: '<?= $block->getCustomerForgotPasswordUrl()?>'
+            customerForgotPasswordUrl: '<?= $block->getCustomerForgotPasswordUrl()?>',
+            baseUrl: '<?= $block->getBaseUrl()?>'
         };
     </script>
     <script type="text/x-magento-init">
     {
         "[data-block='minicart']": {
             "Magento_Ui/js/core/app": <?php echo $block->getJsLayout();?>
+        },
+        "*": {
+            "Magento_Ui/js/block-loader": "<?php echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
         }
     }
     </script>
-    <script>
-        require([
-            'Magento_Ui/js/block-loader'
-        ], function(blockLoader) {
-            blockLoader("<?php echo $block->getViewFileUrl('images/loader-1.gif'); ?>");
-        })
-    </script>
 </div>
 
 
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml
index eea3462380412838de65c0ba3602f8459e60ff3d..72b8a5bf5023ad578385467538fdb88299bce81e 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/link.phtml
@@ -10,31 +10,9 @@
     <button type="button"
             data-role="proceed-to-checkout"
             title="<?php echo __('Proceed to Checkout') ?>"
+            data-mage-init='{"Magento_Checkout/js/proceed-to-checkout":{}}'
             class="action primary checkout<?php echo($block->isDisabled()) ? ' disabled' : ''; ?>"
             <?php if ($block->isDisabled()):?>disabled="disabled"<?php endif; ?>>
         <span><?php echo __('Proceed to Checkout') ?></span>
     </button>
-
-    <script>
-        require(
-            [
-                'jquery',
-                'Magento_Checkout/js/model/cart/authentication-popup',
-                'Magento_Customer/js/customer-data'
-            ],
-            function($, authenticationPopup, customerData) {
-                $('button[data-role="proceed-to-checkout"]').click(function(event) {
-                    event.preventDefault();
-                    var cart = customerData.get('cart'),
-                        customer = customerData.get('customer');
-
-                    if (customer() == false && !cart().isGuestCheckoutAllowed) {
-                        authenticationPopup.showModal();
-                        return false;
-                    }
-                    location.href = window.checkout.checkoutUrl;
-                });
-            }
-        );
-    </script>
 <?php endif?>
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
new file mode 100644
index 0000000000000000000000000000000000000000..87794967ddff9501e2fba69a01fa8644decf056c
--- /dev/null
+++ b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
@@ -0,0 +1,27 @@
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+        'jquery',
+        'Magento_Checkout/js/model/cart/authentication-popup',
+        'Magento_Customer/js/customer-data'
+    ],
+    function($, authenticationPopup, customerData) {
+        return function (config, element) {
+            $(element).click(function(event) {
+                event.preventDefault();
+                var cart = customerData.get('cart'),
+                    customer = customerData.get('customer');
+
+                if (customer() == false && !cart().isGuestCheckoutAllowed) {
+                    authenticationPopup.showModal();
+                    return false;
+                }
+                location.href = window.checkout.checkoutUrl;
+            });
+
+        };
+    }
+);
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js
index 322718862d97ec4ebe4172dd2ac3bfe6833fafff..5ecb8fa64fc25b72b6821fdf11d528a0af7ceff0 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js
@@ -6,11 +6,13 @@ define([
     'uiComponent',
     'Magento_Customer/js/customer-data',
     'jquery',
-    'ko'
-], function (Component, customerData, $, ko) {
+    'ko',
+    'mage/url'
+], function (Component, customerData, $, ko, url) {
     'use strict';
 
     var sidebarInitialized = false;
+    url.setBaseUrl(window.checkout.baseUrl);
 
     function initSidebar() {
         var minicart = $("[data-block='minicart']");
diff --git a/app/code/Magento/Customer/view/frontend/web/js/action/login.js b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
index 743ec6d2f55c3b7d89dc9e2a170359ea7931963f..31d928825415b94304ca8b6f57fb912f6760a8cd 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/action/login.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
@@ -15,7 +15,7 @@ define(
         var callbacks = [],
             action = function(loginData, redirectUrl) {
                 return storage.post(
-                    '/customer/ajax/login',
+                    'customer/ajax/login',
                     JSON.stringify(loginData)
                 ).done(function (response) {
                     if (response.errors) {