pekko/akka-docs-dev/rst/scala/http/routing-dsl/directives/misc-directives/extractClientIP.rst
2015-05-21 17:34:46 +02:00

26 lines
741 B
ReStructuredText

.. _-extractClientIP-:
extractClientIP
===============
Provides the value of ``X-Forwarded-For``, ``Remote-Address``, or ``X-Real-IP`` headers as an instance of
``HttpIp``.
Signature
---------
.. includecode2:: /../../akka-http-scala/src/main/scala/akka/http/scaladsl/server/directives/MiscDirectives.scala
:snippet: extractClientIP
Description
-----------
The akka-http server engine adds the ``Remote-Address`` header to every request automatically if the respective
setting ``akka.http.server.remote-address-header`` is set to ``on``. Per default it is set to ``off``.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/MiscDirectivesExamplesSpec.scala
:snippet: extractClientIP-example