-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadd-provider.pl
executable file
·66 lines (49 loc) · 1.69 KB
/
add-provider.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl
use warnings;
use strict;
use autodie;
my @domains = map { s{^https://}{}; s{/+$}{}; $_ } @ARGV;
open(my $fh, '>', "providers/$domains[0].conf");
print $fh qq{# $0 @domains\n\n};
foreach my $domain ( @domains ) {
print $fh qq{
<VirtualHost *:443>
Include /srv/via-proxy/ssl.conf
ServerName ${domain}.p.vbz.ffzg.hr
RewriteEngine on
# fix broken chunging
#RewriteRule /common/javascript/extjs/ext-all.js https://${domain}/common/javascript/extjs/ext-all.js [R,L]
SSLProxyEngine on
ProxyAddHeaders Off
ProxyPass / https://${domain}/
ProxyPassReverse / https://${domain}/
Header edit* Set-Cookie "(.*)(?i:; *domain=)([^;]+)(.*)" "\$1 ; domain=\$2.p.vbz.ffzg.hr \$3"
#Header edit* Set-Cookie "(.*)(?i:; *secure)" "\$1"
};
print $fh qq{# if there are problems, remove traling /\n};
foreach ( @domains ) {
print $fh qq{\tHeader edit* Location "https://$_/" "https://$_.p.vbz.ffzg.hr/"\n};
}
print $fh qq{
RequestHeader unset Accept-Encoding
};
foreach ( @domains ) {
print $fh qq{\tSubstitute "s|https://$_|https://$_.p.vbz.ffzg.hr|"\n};
}
print $fh qq{
FilterDeclare NEWPATHS
FilterProvider NEWPATHS SUBSTITUTE "%{Content_Type} =~ m|^text/html|"
#FilterProvider NEWPATHS SUBSTITUTE "%{Content_Type} =~ m|^text/css|"
#FilterProvider NEWPATHS SUBSTITUTE "%{Content_Type} =~ m|^text/javascript|"
#FilterProvider NEWPATHS SUBSTITUTE "%{Content_Type} =~ m|^application/javascript|"
FilterChain NEWPATHS
CustomLog /var/log/apache2/access-p.vbz.ffzg.hr.log vhost_combined
</VirtualHost>
};
}
print $fh "\n\n## add domains to SSL certificate:\n";
print "## add domains to SSL certificate:\n";
foreach ( @domains ) {
print $fh qq{# $_.p.vbz.ffzg.hr\n};
print qq{$_.p.vbz.ffzg.hr\n};
}