1

调用服务的实际客户端位于内部属性“REMOTE_ADDRESS”中。但是我们无法从芭蕾舞演员 http:Request 中检索到它。有没有办法我们可以从芭蕾舞演员的 http 请求中获取客户端的远程 IP

芭蕾舞女演员版本 0.97.1

4

1 回答 1

0

您无法从 http 请求中检索 IP 地址。Ballerina 在端点中有远程主机/端口来构造地址。请检查以下代码片段。

@http:ResourceConfig {
    path:"/local",
    methods:["GET"]
}
sample (endpoint caller, http:Request req) {
    string remoteHost = caller.remote.host;
    int remotePort = caller.remote.port;

}        
于 2018-05-22T06:05:48.717 回答