<VirtualHost *:80>
  ServerAdmin admin@opensuse.org
  ServerName events.opensuse.org
  ServerAlias conference.opensuse.org
  ServerAlias summit.opensuse.org

  DocumentRoot /home/osem/events/current/public

  CustomLog /home/osem/events/current/log/access.log combined
  ErrorLog /home/osem/events/current/log/error.log

  RewriteEngine on
  RewriteRule   "^/conference/(.+)"  "https://events.opensuse.org/conferences/$1"  [R,L]

  # Serve assets and uploads directly
  <location /assets>
    ProxyPass !
  </location>
  <location /system>
    ProxyPass !
  </location>

  # Pass the rest on to puma
  ProxyPass / http://127.0.0.1:3000/
  ProxyPassReverse / http://127.0.0.1:3000/

  # don't loose time with IP address lookups
  HostnameLookups Off
  UseCanonicalName Off

  # enable the footer on server-generated documents
  ServerSignature On

  <Directory "/home/osem/events">
    Options FollowSymLinks
  </Directory>

  <Directory "/home/osem/events/current/public">
    Options FollowSymLinks
    AllowOverride All
    Options -MultiViews
    Require all granted
  </Directory>

</VirtualHost>
