# -----------------------------------------------------------------------------
# Virtual host setup for non-ssl connections
# -----------------------------------------------------------------------------

# Webservice
<VirtualHost *:80>
    ServerName webservice.ufmg-dev.br
    ServerAlias 192.168.13.13 webservice.ufmg-dev.br
    DocumentRoot /vagrant/webservice/public
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/webservice/public/>
        <IfModule mod_headers.c>
            Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
            Header always set Access-Control-Allow-Origin "%{ORIGIN}e"
            Header always set Access-Control-Allow-Credentials "true"
            Header always set Access-Control-Allow-Headers " X-Accept-Charset,X-Accept,Content-Type,Authorization "
        </IfModule>

        # with AJAX withCredentials=true (cookies sent, SSL allowed...)
        SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1

        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_METHOD} OPTIONS
            RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]
        </IfModule>

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# Portal
<VirtualHost *:80>
    ServerName portal.ufmg-dev.br
    ServerAlias 192.168.13.13 portal.ufmg-dev.br
    DocumentRoot /vagrant/portal/web
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/portal/web/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# CMS
<VirtualHost *:80>
    ServerName cms.ufmg-dev.br
    ServerAlias 192.168.13.13 cms.ufmg-dev.br
    DocumentRoot /vagrant/cms/build
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/cms/build/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

########
# ZUNI #
########

# ZUNI Webservice
<VirtualHost *:80>
    ServerName zuni.ufmg-dev.br
    ServerAlias 192.168.13.13 zuni.ufmg-dev.br
    DocumentRoot /vagrant/zuni/webservice/public
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/zuni/webservice/public/>
        <IfModule mod_headers.c>
            Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
            Header always set Access-Control-Allow-Origin "%{ORIGIN}e"
            Header always set Access-Control-Allow-Credentials "true"
            Header always set Access-Control-Allow-Headers " X-Accept-Charset,X-Accept,Content-Type,Authorization "
        </IfModule>

        # with AJAX withCredentials=true (cookies sent, SSL allowed...)
        SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1

        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_METHOD} OPTIONS
            RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]
        </IfModule>

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# ZUNI Html
<VirtualHost *:80>
    ServerName zuni-html.ufmg-dev.br
    ServerAlias 192.168.13.13 zuni-html.ufmg-dev.br
    DocumentRoot /vagrant/zuni/html
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/zuni/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# ZUNI Application
<VirtualHost *:80>
    ServerName zuni-application.ufmg-dev.br
    ServerAlias 192.168.13.13 zuni-application.ufmg-dev.br
    DocumentRoot /vagrant/zuni/application
    SetEnv APPLICATION_ENV development

    <Directory /vagrant/zuni/application/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
