Skip to content

Apache httpd

Philip Helger edited this page Jul 14, 2020 · 1 revision

Running behind an httpd

It is possible to run the SMP on an Tomcat (or the like) that is proxied via an httpd (e.g. per mod_jk or mod_proxy) to the public. In this case and the SMP runs on Tomcat in a context different than ROOT, it is important to

  • set the smp.forceroot configuration property to true (see Configuration for details) and
  • to change the path of the SMP session cookie (usually JSESSIONID) from the original path to the destination path as well

Assuming you want to proxy the SMP from a local Tomcat (with active AJP connector on port 8009) running in context path /smp to the domain test-smp.example.org you might consider adding something (similar to) the following to your httpd VirtualHost configuration:

   ServerName  test-smp.example.org:80
   
   AllowEncodedSlashes NoDecode

   # Remove an optional 'Secure' flag from the cookie named JSESSIONID
   Header edit "Set-Cookie: JSESSIONID=" Secure " "

   ProxyPass         /  ajp://127.0.0.1:8009/smp/ nocanon
   ProxyPassReverse  /  ajp://127.0.0.1:8009/smp/
   ProxyPassReverse  /  http://test-smp.example.org/smp/
   
   # Change the path of the cookies as well (from "/smp" to "/")
   ProxyPassReverseCookiePath /smp /

Note: You can also proxy to http instead of ajp. In that case replace ajp://127.0.0.1:8009/smp/ with http://127.0.0.1:8080/smp/ (assuming Tomcat running on port 8080)

Important: This must be the very first VirtualHost element in your configuration to handle arbitrary names. See the last comment of https://github.com/phax/peppol-smp-server/issues/5 on this.

Note: For test SMPs (registering participants to the SMK) you might want to add ServerAlias *.acc.edelivery.tech.ec.europa.eu and for production SMPs (registering to SML) you could add ServerAlias *.edelivery.tech.ec.europa.eu. If both SMPs are on one server, make sure the test VirtualHost is before the production VirtualHost so that the .acc. entries are surely handled by the test system.