Server Side Includes

Last updated 12th February 2021

Objective

Server side includes is a powerful mechanism by which you can at the same time leverage caching and serve dynamic content.

You can activate or deactivate SSI on a per-route basis in your .platform/routes.yaml for example:

"https://{default}/":
    type: upstream
    upstream: "app:http"
    cache:
      enabled: false
    ssi:
        enabled: true
"https://{default}/time.php":
    type: upstream
    upstream: "app:http"
    cache:
      enabled: true

It allows you to include in your HTML response directives that will make the server "fill-in" parts of the HTML respecting the caching you setup.

For example you could in a dynamic non-cached page include a block that would have been cached for example in the /index.php page we would have:

<?php
echo date(DATE_RFC2822);
?>
<!--#include virtual="time.php" -->

and in time.php we had

<?php
header("Cache-Control: max-age=600");
echo date(DATE_RFC2822);

And you visit the home page you will see, as you refresh the page, the time on the top will continue to change, while the one on the bottom will only change every 600 seconds.

For more on SSI functionality see the nginx documentation.


Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.


These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices exclude VAT. VAT may vary according to the customer's country of residence.