1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 06:15:42 +00:00

Use https in RDAP URLs provided (#2807)

Load balancer / internal redirections can result in the final request
URL lacking "https" when finally getting to the servlet. As a result,
even if you use https in the request, the resulting URL can be plain
http.

We need to include the actual (HTTPS) URL in the output, so replace it.
This commit is contained in:
gbrodman
2025-08-20 10:15:54 -04:00
committed by GitHub
parent 7c92928f2c
commit 16859bb36a

View File

@@ -135,7 +135,8 @@ public final class RequestModule {
@Provides
@RequestUrl
static String provideRequestUrl(HttpServletRequest req) {
return req.getRequestURL().toString();
String url = req.getRequestURL().toString();
return url.startsWith("https") ? url : url.replaceFirst("http", "https");
}
@Provides