Skip to content

Commit

Permalink
do not apply X-Requested-With : XMLHttpRequest header in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Leemoonsoo committed Jul 5, 2017
1 parent f3f24f3 commit bf15efc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zeppelin-web/src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules)
})

// handel logout on API failure
.config(function ($httpProvider, $provide) {
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
.config(function ($httpProvider, $provide) {
if (process.env.PROD) {
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
}
$provide.factory('httpInterceptor', function ($q, $rootScope) {
return {
'responseError': function (rejection) {
Expand Down Expand Up @@ -177,7 +179,7 @@ function auth () {
},
crossDomain: true
})
let config = {headers: { 'X-Requested-With': 'XMLHttpRequest' }}
let config = (process.env.PROD) ? {headers: { 'X-Requested-With': 'XMLHttpRequest' }} : {}
return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket', config).then(function (response) {
zeppelinWebApp.run(function ($rootScope) {
$rootScope.ticket = angular.fromJson(response.data).body
Expand Down
1 change: 1 addition & 0 deletions zeppelin-web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ module.exports = function makeWebpackConfig () {
HELIUM_BUNDLE_DEV: process.env.HELIUM_BUNDLE_DEV,
SERVER_PORT: serverPort,
WEB_PORT: webPort,
PROD: isProd,
BUILD_CI: (isCI) ? JSON.stringify(true) : JSON.stringify(false)
}
})
Expand Down

0 comments on commit bf15efc

Please sign in to comment.