We have a deployed website behind a reverse proxy that is not configured correctly to send the x-forward-proto
header. As a result, the back-end sends some json values as http
when they should instead be https
( ref: https://spring.io/guides/gs/rest-hateoas/ ) .
As a temporary testing solution I have made the following firefox greesemonkey userscript.
// ==UserScript==
// @name ATPatchJsonProtocol_01
// @namespace https://WEBSITEURL
// @description Replaces http with https in json responses
// @include https://WEBSITEURL/*
// @version 1
// @grant none
// ==/UserScript==
var vctApp = angular.module('app');
vctApp.factory('myInterceptor', ['$q', function($q) {
var responseInterceptor = {
response: function (response) {
if(response.data != undefined) //or response.data
var asString = JSON.stringify(response.data);
asString = asString.replace(/http/g, 'https');
response.data = JSON.parse(asString);
return response;
}
};
return responseInterceptor;
}])
.config(function ($httpProvider) {
//alert(JSON.stringify($httpProvider.interceptors);
$httpProvider.interceptors.push('myInterceptor');
});
alert('You are currently running a greesemonkey user script that adds delays for AT site.\nThe script modifies server responses to allow the app to function with a incomplete reverse proxy configuration.');
Comments/corrections/suggestions?