New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new API AccessLogArgProvider#connectionInformation()
for retrieving information related to host/remote address/scheme
#2606
Add new API AccessLogArgProvider#connectionInformation()
for retrieving information related to host/remote address/scheme
#2606
Conversation
Can you take a look ? PS: maybe we should not include this PR for the next upcoming release, that's why I did not add a milestone. |
@pderop Now with this change we have the other problem - always log what is provided with We need to be able to log either with |
…e to choose between remoteAddress vs remotePeer.
indeed, the PR breaks something: if the HttpServer second attempt: To let people choose either connection peer address, or forwarded remote client address, the last commit is adding a new please take a look ? |
mmm, please wait, sanity checks are failing. |
The sanity check error is now fixed. |
Let's just follow the suggestion done in the original #2603: simply expose the |
…und, we need to introduce a new ConnectionInformation interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small fixes for the javadoc
@@ -16,12 +16,15 @@ | |||
package reactor.netty.http.server.logging; | |||
|
|||
import io.netty.handler.codec.http.cookie.Cookie; | |||
import reactor.netty.http.server.ConnectionInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import reactor.netty.http.server.ConnectionInfo; |
@@ -54,10 +57,26 @@ public interface AccessLogArgProvider { | |||
* Returns the address of the remote peer or {@code null} in case of Unix Domain Sockets. | |||
* | |||
* @return the peer's address | |||
* @deprecated Use {@link ConnectionInformation#connectionRemoteAddress()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @deprecated Use {@link ConnectionInformation#connectionRemoteAddress()} | |
* @deprecated as of 1.0.26. Use {@link ConnectionInformation#connectionRemoteAddress()} |
/** | ||
* Returns the information about the current connection. | ||
* <p> Note that the {@link ConnectionInfo#getRemoteAddress()} will return the forwarded | ||
* remote client address if the server is configured in forwarded mode. | ||
* | ||
* @since 1.0.26 | ||
* @return the connection info | ||
* @see reactor.netty.http.server.HttpServer#forwarded(BiFunction) | ||
* @see reactor.netty.http.server.HttpServer#forwarded(BiFunction) | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* Returns the information about the current connection. | |
* <p> Note that the {@link ConnectionInfo#getRemoteAddress()} will return the forwarded | |
* remote client address if the server is configured in forwarded mode. | |
* | |
* @since 1.0.26 | |
* @return the connection info | |
* @see reactor.netty.http.server.HttpServer#forwarded(BiFunction) | |
* @see reactor.netty.http.server.HttpServer#forwarded(BiFunction) | |
*/ | |
/** | |
* Returns the information about the current connection. | |
* <p> Note that the {@link ConnectionInformation#remoteAddress()} will return the forwarded | |
* remote client address if the server is configured in forwarded mode. | |
* | |
* @since 1.0.26 | |
* @return the connection info | |
* @see reactor.netty.http.server.HttpServer#forwarded(BiFunction) | |
*/ |
AccessLogArgProvider#connectionInformation()
for retrieving information related to host/remote address/scheme
This PR addresses #2603 issue, and allows any custom AccessLogFactory to get more informations about the connection on which the request has been received. The AccessLogArgProvider interface has a new connectionInformation() method which returns a new
ConnectionInformation
interface, which has the following methods:Fixes #2603