mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
Report deprecated http->https redirect in nginx conf
This commit is contained in:
parent
5c972a2607
commit
167f687643
1 changed files with 23 additions and 0 deletions
|
@ -1103,6 +1103,29 @@ class Configurations(TestSuite):
|
||||||
"DO NOT run the app PHP worker as root or www-data! Use a dedicated system user for this app!"
|
"DO NOT run the app PHP worker as root or www-data! Use a dedicated system user for this app!"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@test()
|
||||||
|
def nginx_https_redirect(self):
|
||||||
|
|
||||||
|
app = self.app
|
||||||
|
|
||||||
|
for filename in (
|
||||||
|
os.listdir(app.path + "/conf") if os.path.exists(app.path + "/conf") else []
|
||||||
|
):
|
||||||
|
# Ignore subdirs or filename not containing nginx in the name
|
||||||
|
if (
|
||||||
|
not os.path.isfile(app.path + "/conf/" + filename)
|
||||||
|
or "nginx" not in filename
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
|
||||||
|
content = open(app.path + "/conf/" + filename).read()
|
||||||
|
if "if ($scheme = http)" in content and "rewrite ^ https" in content:
|
||||||
|
yield Info(
|
||||||
|
"Since Yunohost 4.3, the http->https redirect is handled by the core, "
|
||||||
|
"therefore having an if ($scheme = http) { rewrite ^ https://... } block "
|
||||||
|
"in the nginx config file is deprecated. (This helps with supporting Yunohost-behind-reverse-proxy use case)"
|
||||||
|
)
|
||||||
|
|
||||||
@test()
|
@test()
|
||||||
def misc_nginx_add_header(self):
|
def misc_nginx_add_header(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue