mirror of
https://github.com/nextcloud/all-in-one.git
synced 2024-09-21 15:26:16 +08:00
Merge pull request #3133 from nextcloud/enh/noid/add-domain-validator
add domain-validator
This commit is contained in:
commit
725bbb7c05
|
@ -14,18 +14,17 @@
|
|||
servers {
|
||||
protocols h1 h2 h2c
|
||||
}
|
||||
|
||||
on_demand_tls {
|
||||
ask http://localhost:9876/
|
||||
}
|
||||
}
|
||||
|
||||
http://:80 {
|
||||
redir https://{host}{uri}
|
||||
}
|
||||
|
||||
# Match only host names and not ip-addresses:
|
||||
https://*.*:8443,
|
||||
https://*.*.*:8443,
|
||||
https://*.*.*.*:8443,
|
||||
https://*.*.*.*.*:8443,
|
||||
https://*.*.*.*.*.*:8443 {
|
||||
https://:8443 {
|
||||
|
||||
reverse_proxy localhost:8000
|
||||
|
||||
|
|
|
@ -55,3 +55,11 @@ stderr_logfile=/dev/stderr
|
|||
stderr_logfile_maxbytes=0
|
||||
command=/session-deduplicator.sh
|
||||
user=root
|
||||
|
||||
[program:domain-validator]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php -S 127.0.0.1:9876 /var/www/docker-aio/php/domain-validator.php
|
||||
user=www-data
|
||||
|
|
17
php/domain-validator.php
Normal file
17
php/domain-validator.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$domain = $_GET['domain'] ?? '';
|
||||
|
||||
if (strpos($domain, '.') === false) {
|
||||
http_response_code(400);
|
||||
} elseif (strpos($domain, '/') !== false) {
|
||||
http_response_code(400);
|
||||
} elseif (strpos($domain, ':') !== false) {
|
||||
http_response_code(400);
|
||||
} elseif (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
||||
http_response_code(400);
|
||||
} elseif (filter_var($domain, FILTER_VALIDATE_IP)) {
|
||||
http_response_code(400);
|
||||
} else {
|
||||
http_response_code(200);
|
||||
}
|
Loading…
Reference in a new issue