l10n->t('HTTPS access and URLs'); } public function run(): SetupResult { if (!\OC::$CLI && $this->request->getServerProtocol() !== 'https') { if (!preg_match('/(?:^(?:localhost|127\.0\.0\.1|::1)|\.onion)$/', $this->request->getInsecureServerHost())) { return SetupResult::error( $this->l10n->t('Accessing site insecurely via HTTP. You are strongly advised to set up your server to require HTTPS instead. Without it some important web functionality like "copy to clipboard" or "service workers" will not work!'), $this->urlGenerator->linkToDocs('admin-security') ); } else { return SetupResult::info( $this->l10n->t('Accessing site insecurely via HTTP.'), $this->urlGenerator->linkToDocs('admin-security') ); } } $generatedUrl = $this->urlGenerator->getAbsoluteURL('index.php'); if (!str_starts_with($generatedUrl, 'https://')) { if (!\OC::$CLI) { return SetupResult::warning( $this->l10n->t('You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This likely means that your instance is behind a reverse proxy and the Nextcloud `overwrite*` config values are not set correctly.'), $this->urlGenerator->linkToDocs('admin-reverse-proxy') ); /* We were called from CLI so we can't be 100% sure which scenario is applicable */ } else { return SetupResult::info( $this->l10n->t('Your instance is generating insecure URLs. If you access your instance over HTTPS, this likely means that your instance is behind a reverse proxy and the Nextcloud `overwrite*` config values are not set correctly.'), $this->urlGenerator->linkToDocs('admin-reverse-proxy') ); } } return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.')); } }