Fix popup-box authenticate on session disconnect
On the session Web UI page, when we disconnect the current session,
instead of navigating to the login page, the browser populates the
authentication window for basic authorization.
If basic authentication is enabled, we are adding the www-authenticate
header to unauthorizing requests.
As per redfish, we have to set the "Accept" and "X-Requested-With"
header for the request from Web UI. This patch set will add those
headers.
Tested:
Logged in to the WebUI and navigated to the sessions page. Clicked
"Disconnect" to the current session and the WebUI is navigated to login.
page as expected.
Change-Id: I61cccbf41e854683e6cd5aa80fa72593ae4aa698
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/src/store/api.js b/src/store/api.js
index 0247288..51c5cdc 100644
--- a/src/store/api.js
+++ b/src/store/api.js
@@ -4,6 +4,9 @@
//dotenv customizations.
import store from '../store';
+Axios.defaults.headers.common['Accept'] = 'application/json';
+Axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+
const api = Axios.create({
withCredentials: true,
});