Github user wido commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1547#discussion_r65104294 --- Diff: systemvm/patches/debian/config/etc/init.d/cloud-early-config --- @@ -1207,33 +1145,27 @@ setup_secstorage() { fi setup_apache2 $ETH2_IP + # Deprecated, should move to Cs Python all of it + sed -e "s/<VirtualHost .*:80>/<VirtualHost $ETH2_IP:80>/" \ + -e "s/<VirtualHost .*:443>/<VirtualHost $ETH2_IP:443>/" \ + -e "s/Listen .*:80/Listen $ETH2_IP:80/g" \ + -e "s/Listen .*:443/Listen $ETH2_IP:443/g" \ + -e "s/NameVirtualHost .*:80/NameVirtualHost $ETH2_IP:80/g" /etc/apache2/vhost.template > /etc/apache2/sites-enabled/vhost-${ETH2_IP}.conf + log_it "setting up apache2 for post upload of volume/template" a2enmod proxy a2enmod proxy_http a2enmod headers - SSL_FILE="/etc/apache2/sites-available/default-ssl" - PATTERN="RewriteRule ^\/upload\/(.*)" - CORS_PATTERN="Header set Access-Control-Allow-Origin" - if [ -f $SSL_FILE ]; then - if grep -q "$PATTERN" $SSL_FILE ; then - log_it "rewrite rules already exist in file $SSL_FILE" - else - log_it "adding rewrite rules to file: $SSL_FILE" - sed -i -e "s/<\/VirtualHost>/RewriteEngine On \n&/" $SSL_FILE - sed -i -e "s/<\/VirtualHost>/RewriteCond %{HTTPS} =on \n&/" $SSL_FILE - sed -i -e "s/<\/VirtualHost>/RewriteCond %{REQUEST_METHOD} =POST \n&/" $SSL_FILE - sed -i -e "s/<\/VirtualHost>/RewriteRule ^\/upload\/(.*) http:\/\/127.0.0.1:8210\/upload?uuid=\$1 [P,L] \n&/" $SSL_FILE - fi - if grep -q "$CORS_PATTERN" $SSL_FILE ; then - log_it "cors rules already exist in file $SSL_FILE" - else - log_it "adding cors rules to file: $SSL_FILE" - sed -i -e "s/<\/VirtualHost>/Header always set Access-Control-Allow-Origin \"*\" \n&/" $SSL_FILE - sed -i -e "s/<\/VirtualHost>/Header always set Access-Control-Allow-Methods \"POST, OPTIONS\" \n&/" $SSL_FILE - sed -i -e "s/<\/VirtualHost>/Header always set Access-Control-Allow-Headers \"x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires\" \n&/" $SSL_FILE - fi - fi + cat >/etc/apache2/cors.conf <<CORS +RewriteEngine On +RewriteCond %{HTTPS} =on +RewriteCond %{REQUEST_METHOD} =POST +RewriteRule ^/upload/(.*) http://127.0.0.1:8210/upload?uuid=\$1 [P,L] +Header always set Access-Control-Allow-Origin "*" +Header always set Access-Control-Allow-Methods "POST, OPTIONS" +Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires" +CORS --- End diff -- This file doesn't seem to be generated and thus fails Apache to start: <pre>root@r-10-VM:~# ls -l /etc/apache2/ total 73 -rw-r--r-- 1 root root 9675 May 30 20:10 apache2.conf drwxr-xr-x 2 root root 1024 May 30 20:10 conf.d -rw-r--r-- 1 root root 1465 Aug 18 2015 envvars -rwxr-xr-x 1 root root 8 May 30 19:12 httpd.conf -rw-r--r-- 1 root root 31063 Aug 14 2015 magic drwxr-xr-x 2 root root 5120 May 30 20:10 mods-available drwxr-xr-x 2 root root 1024 Nov 9 2015 mods-enabled drwxr-xr-x 2 root root 1024 May 30 19:54 sites-available drwxr-xr-x 2 root root 1024 May 30 20:24 sites-enabled -rwxr-xr-x 1 root root 9289 Jan 30 19:21 vhostexample.conf -rwxr-xr-x 1 root root 10148 May 30 20:25 vhost.template root@r-10-VM:~#</pre>
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---