.. _integrator_https:

HTTPS
=====

*New in c2cgeoportal 0.8.*

If your application is accessed in HTTPS, you have to make sure that all URLs
generated by the application (CSS and Javascript files, images, MapServer 
requests, etc.) use the HTTPS scheme as well. Otherwise the browser will
prompt "unsecure content" warnings.

If the application is placed behind some proxies that remove the SSL 
encryption, you may add in the application configuration some HTTP header flag
whose value will be tested in order to figure out if the URL must be generated
using the HTTPS scheme. This flag must be provided in the HTTP headers that
c2cgeoportal receives.

Example of configuration:

Edit ``config.yaml.in`` (in this example we use the ``X_HTTPS`` flag)::

        https_flag_header = X_HTTPS
        https_flag_value = on

In some Mako template, if you need to know what scheme is used, you may test
the value of ``request.scheme``.

.. _integrator_https:

HTTPS
=====

*New in c2cgeoportal 0.8.*

If your application is accessed in HTTPS, you have to make sure that all URLs
generated by the application (CSS and Javascript files, images, MapServer
requests, etc.) use the HTTPS scheme as well. Otherwise the browser will
prompt "unsecure content" warnings.

If the application is placed behind some proxy that remove the SSL encryption
(plain HTTP is used between the proxy and the server) then some specific
configuration is required both on the c2cgeoportal application, and on the
proxy:

* The proxy should add a specific header to the requests. For example ``X-Https
  on`` (``X-Https`` is the header name, and ``on`` is the header value).
* To make c2cgeoportal generate HTTPS URLs when requests with this header are
  received you will use the following configuration in ``config.yaml.in``::

      https_flag_header: X-Https
      https_flag_value: on

  ``https_flag_header`` specifies the header name, and ``https_flag_value``
  specifies the header value. When c2cgeoportal receives requests with this
  header all the URLs it will generate for the content of the corresponding
  response will use the HTTPS scheme.

In Mako templates, if you need to know what scheme is used, you may test the
value of ``request.scheme``. For example::

    var WMTS_OPTIONS = {
    % if request.scheme == 'https':
        url: ${request.registry.settings.get('tiles_https_urls') | n},
    % else:
        url: ${request.registry.settings.get('tiles_http_urls') | n},
    % endif
    /* ... */
    };

Rewrite of the HTTPS section in the doc
Rewrite of the HTTPS section in the doc
