Polishing contribution

Closes gh-33638
This commit is contained in:
rstoyanchev
2024-10-08 07:05:16 +01:00
parent a78385f8e5
commit a84a41fa43
3 changed files with 10 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import reactor.netty.http.server.HttpServerRequest;
import org.springframework.util.Assert;
/**
* Helper class for creating a {@link URI} from a reactor {@link HttpServerRequest}.
* Helper class to create {@link URI} from a Reactor Netty request.
*
* @author Arjen Poutsma
* @since 6.0.8
@@ -48,12 +48,16 @@ abstract class ReactorUriHelper {
builder.append(port);
}
// Reactor Netty has config whether to extract and apply forwarded headers.
// We apply the prefix manually as it affects the contextPath too.
String prefix = request.forwardedPrefix();
if (prefix != null && !prefix.isEmpty()) {
builder.append(prefix);
}
appendRequestUri(request, builder);
return new URI(builder.toString());
}