LoginSignup
2
1

More than 5 years have passed since last update.

Vapor 3.0 でクライアントのリモートIPアドレスを知る方法

Posted at

Vapor 2 では、クライアントのリモートIPアドレスを知るには req.peerHostname を使うことができましたが、Vapor 3.0 では Request や HTTP モジュールが刷新され上記のメソッドも使えなくなっています。

Vapor 3.0 でクライアントのリモートIPアドレスを知る方法

req.http.remotePeer.hostname

で取得できます。

詳細:
https://api.vapor.codes/http/latest/HTTP/Protocols/HTTPMessage.html

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1