GAE не позволяет использовать якоря в app.yaml. В противном случае вы можете сделать что-то вроде:
runtime: python37
entrypoint: gunicorn -b :$PORT application:app --timeout 36000
headers: &headers
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer
Feature-Policy: microphone 'none'; notifications 'none'
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' ; font-src fonts.gstatic.com ; style-src 'self' 'unsafe-inline' fonts.googleapis.com
handlers:
- url: /sitemap.xml
static_files: public/sitemap.xml
secure: always
upload: public/sitemap.xml
http_headers: *headers
Если вы развертываете с помощью Admin API (https://cloud.google.com/appengine/docs/admin-api/deploying-overview), вы можете использовать вышеуказанный app.yaml
, но преобразовать его в app.json
(например, https://www.convertjson.com/yaml-to-json.htm), который преобразует приведенный выше код yaml с якорями в более длинную версию:
{
"runtime": "python37",
"entrypoint": "gunicorn -b :$PORT application:app --timeout 36000",
"headers": {
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Frame-Options": "SAMEORIGIN",
"X-Content-Type-Options": "nosniff",
"Referrer-Policy": "no-referrer",
"Feature-Policy": "microphone 'none'; notifications 'none'",
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline' ; font-src fonts.gstatic.com ; style-src 'self' 'unsafe-inline' fonts.googleapis.com"
},
"handlers": [
{
"url": "/sitemap.xml",
"static_files": "public/sitemap.xml",
"secure": "always",
"upload": "public/sitemap.xml",
"http_headers": {
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Frame-Options": "SAMEORIGIN",
"X-Content-Type-Options": "nosniff",
"Referrer-Policy": "no-referrer",
"Feature-Policy": "microphone 'none'; notifications 'none'",
"Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline' ; font-src fonts.gstatic.com ; style-src 'self' 'unsafe-inline' fonts.googleapis.com"
}
}
]
}
Вероятно, это не то, на что вы надеялись, но поместив его там.