LoginSignup
1
1

More than 3 years have passed since last update.

Azure WebAppsでリモートIPはどうやってとれるか

Posted at

はじめに

Azure WebApps for containerにSpringBootで作ったWebアプリをデプロイしているのですが、一部のパスにIP制限をかける必要があり、色々試した結果わかりました。
今回試したのは、WebAppsに直接リクエストを投げた場合なので前面にApplicationGatewayなど別物が挟まると変わる可能性があります。

結論

リクエストのx-client-ipの中に入っています。

補足

x-forwarded-forにもリモートIPが入っていますが、WebAppsに直接リクエストを投げた時はポート番号も含まれた状態になっていました。
そのため、TomcatのRemoteIpValveをデフォルトの状態で動かすと、パースができずIllegalArgumentExceptionで落ちます。

1
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
1
1