Set CORS headers for both http/https in SSVM apache config (#9389)

This commit is contained in:
salfers 2026-01-30 10:53:44 +01:00 committed by GitHub
parent c1c1b0e765
commit e1d512e5fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 28 deletions

View File

@ -39,8 +39,8 @@
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
# Include HTTP configuration **IF SET**
IncludeOptional /etc/apache2/http.conf
# Include CORS configuration **IF SET**
IncludeOptional /etc/apache2/cors.conf
</VirtualHost>
@ -86,8 +86,8 @@
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
# Include HTTPS configuration **IF SET**
IncludeOptional /etc/apache2/https.conf
# Include CORS configuration **IF SET**
IncludeOptional /etc/apache2/cors.conf
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.

View File

@ -924,9 +924,6 @@ parse_cmd_line() {
privateMtu)
export PRIVATEMTU=$VALUE
;;
useHttpsToUpload)
export USEHTTPS=$VALUE
;;
vncport)
export VNCPORT=$VALUE
;;

View File

@ -50,33 +50,14 @@ setup_secstorage() {
a2enmod proxy_http
a2enmod headers
if [ -z $USEHTTPS ] | $USEHTTPS ; then
if [ -f /etc/apache2/http.conf ]; then
rm -rf /etc/apache2/http.conf
fi
cat >/etc/apache2/https.conf <<HTTPS
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"
HTTPS
else
if [ -f /etc/apache2/https.conf ]; then
rm -rf /etc/apache2/https.conf
fi
cat >/etc/apache2/http.conf <<HTTP
cat >/etc/apache2/cors.conf <<CORS
RewriteEngine 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"
HTTP
fi
CORS
disable_rpfilter
enable_fwding 0