pekko/akka-docs/rst/java/http/routing-dsl/directives/scheme-directives/scheme.rst
Fabian Gutierrez 43c09a4b63 Add scheme directive example in javadsl (#20586)
* add scheme directive test

* link documentation to the scheme directive
2016-05-23 12:49:54 +02:00

22 lines
703 B
ReStructuredText

.. _-scheme-java-:
scheme
======
Description
-----------
Rejects a request if its Uri scheme does not match a given one.
The ``scheme`` directive can be used to match requests by their Uri scheme, only passing
through requests that match the specified scheme and rejecting all others.
A typical use case for the ``scheme`` directive would be to reject requests coming in over
http instead of https, or to redirect such requests to the matching https URI with a
``MovedPermanently``.
For simply extracting the scheme name, see the :ref:`-extractScheme-java-` directive.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/SchemeDirectivesExamplesTest.java#scheme