To support AMP pages over HTTPS using a CNAME, a reverse proxy must be set up.

To configure a reverse proxy and HTTP cache using Apache web server, the following steps must be performed. This procedure assumes that the Apache web server is already in place and working:

1- Install the necessary Apache modules

The following is a list of the Apache modules necessary for this setup to work:

  • proxy
  • proxy_http
  • proxy_html
  • cache
  • cache_disk


To enable these Apache modules the following command is used. This command is an example for installing the cache_disk module and will need to be repeated for each of the modules in the list above.

~$ sudo a2enmod cache_disk
CODE

2 - Modify the virtual hosts configuration file

The following is an example of a virtual hosts file containing the additional syntax required. The syntax for the reverse proxy and cache configuration is in red

In the example below, the placeholder < DNS > is used. The correct DNS entry will be provided by the Customer Success team.

Replace the placeholder with the correct DNS entry.

 

<VirtualHost *:80>

          ServerAdmin webmaster@localhost


          DocumentRoot /

          ErrorLog ${APACHE_LOG_DIR}/error.log


          CustomLog ${APACHE_LOG_DIR}/access.log combined

          CacheQuickHandler off

          CacheLock on

          CacheLockPath /tmp/mod_cache-lock

          CacheIgnoreCacheControl on

         

         <Location "/">

                    ProxyPreserveHost On

                    ProxyPass  http:://< DNS >/

                    ProxyPassReverse  http:://< DNS >/

                   CacheEnable disk

                   CacheHeader on

          </Location>

</VirtualHost>

3 - Apache configuration test

After these changes are made to the virtual hosts file, run the apache configuration test to ensure syntax is correct.

4 - Restart the Apache web server

Restart the Apache web server to put the changes into place.

 

For information on how to set up a reverse proxy on AWS (Amazon Web Services), see this article.