Skip to content

Apache Lucene open-source search software

SOLR-9584: Use relative URLs also for files and query

Jan Høydahlbd459c127566
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 325760272b3..bd81afa267d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -74,9 +74,6 @@ Optimizations
string fields from the FieldCache, resulting in up to 56% better throughput for those cases.
(yonik)
-* SOLR-9584: Support Solr being proxied with another endpoint than default /solr, by using relative links
- in AdminUI javascripts (Yun Jie Zhou via janhoy)
-
* SOLR-5944: In-place updates of Numeric DocValues. To leverage this, the _version_ field and the updated
field must both be stored=false, indexed=false, docValues=true. (Ishan Chattopadhyaya, hossman, noble,
shalin, yonik)
@@ -175,6 +172,10 @@ Optimizations
* SOLR-9764: All filters that which all documents in the index now share the same memory (DocSet).
(Michael Sun, yonik)
+* SOLR-9584: Support Solr being proxied with another endpoint than default /solr, by using relative links
+ in AdminUI javascripts (Yun Jie Zhou via janhoy)
+
+
Other Changes
----------------------
* SOLR-9980: Expose configVersion in core admin status (Jessica Cheng Mallet via Tomás Fernández Löbbe)
diff --git a/solr/webapp/web/js/angular/controllers/files.js b/solr/webapp/web/js/angular/controllers/files.js
index 00ea4b19ff7..c1d7abfe24a 100644
--- a/solr/webapp/web/js/angular/controllers/files.js
+++ b/solr/webapp/web/js/angular/controllers/files.js
@@ -25,7 +25,7 @@ solrAdminApp.controller('FilesController',
$scope.file = $location.search().file;
$scope.content = null;
- $scope.baseurl = $location.protocol()+ "://" + $location.host() + ":" + $location.port();
+ $scope.baseurl = $location.absUrl().substr(0,$location.absUrl().indexOf("#")); // Including /solr/ context
$scope.refresh = function () {
@@ -81,7 +81,7 @@ solrAdminApp.controller('FilesController',
Files.get({core: $routeParams.core, file: $scope.file, contentType: contentType}, function(data) {
$scope.content = data.data;
- $scope.url = $scope.baseurl + data.config.url + "?" + $.param(data.config.params);
+ $scope.url = data.config.url + "?" + $.param(data.config.params); // relative URL
if (contentType.indexOf("text/plain") && (data.data.indexOf("<?xml")>=0) || data.data.indexOf("<!--")>=0) {
$scope.lang = "xml";
} else {
diff --git a/solr/webapp/web/js/angular/controllers/query.js b/solr/webapp/web/js/angular/controllers/query.js
index 1695647a3a0..5dd105b149e 100644
--- a/solr/webapp/web/js/angular/controllers/query.js
+++ b/solr/webapp/web/js/angular/controllers/query.js
@@ -88,9 +88,9 @@ solrAdminApp.controller('QueryController',
Query.query(params, function(data) {
$scope.lang = $scope.query.wt;
$scope.response = data;
- $scope.url = $location.protocol() + "://" +
- $location.host() + ":" +
- $location.port() + url;
+ // Use relative URL to make it also work through proxies that may have a different host/port/context
+ $scope.url = url;
+ $scope.hostPortContext = $location.absUrl().substr(0,$location.absUrl().indexOf("#")); // For display only
});
};
diff --git a/solr/webapp/web/partials/files.html b/solr/webapp/web/partials/files.html
index 1278fbeccb3..61914de9844 100644
--- a/solr/webapp/web/partials/files.html
+++ b/solr/webapp/web/partials/files.html
@@ -27,7 +27,7 @@ limitations under the License.
<div class="top clearfix">
- <a id="url" class="address-bar" href="{{url}}" ng-show="url">{{url}}</a>
+ <a id="url" class="address-bar" href="{{url}}" ng-show="url">{{baseurl}}{{url}}</a>
</div>
diff --git a/solr/webapp/web/partials/query.html b/solr/webapp/web/partials/query.html
index 31bc2420066..d68d236486c 100644
--- a/solr/webapp/web/partials/query.html
+++ b/solr/webapp/web/partials/query.html
@@ -345,7 +345,7 @@ limitations under the License.
<div id="result">
- <a ng-show="response.data" id="url" class="address-bar" ng-href="{{url}}">{{url}}</a>
+ <a ng-show="response.data" id="url" class="address-bar" ng-href="{{url}}">{{hostPortContext}}{{url}}</a>
<div id="response">
<pre class="syntax language-{{lang}}"><code ng-bind-html="response.data | highlight:lang | unsafe"></code></pre>