From: Andreas Gerstenberg Date: Mon, 16 Oct 2017 12:34:09 +0000 (+0200) Subject: spk-spar-checker modify rewrites X-Git-Tag: v0.1.0~2316 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=4c28a6436c77dd4f2a16e7527a7408c10539995a;p=pixelpark%2Fhiera.git spk-spar-checker modify rewrites --- diff --git a/customer/spk-spar-checker/production.yaml b/customer/spk-spar-checker/production.yaml index 98d67ccf..23c81987 100644 --- a/customer/spk-spar-checker/production.yaml +++ b/customer/spk-spar-checker/production.yaml @@ -67,6 +67,37 @@ infra::profile::apache::pp_vhosts: allow_override: - None directoryindex: 'index.html' +# neu + custom_fragment: 'AddType text/plain .tmpl' + rewrites: + - comment: 'frontend root rewrite' + rewrite_cond: + - '%{REQUEST_URI} ^/$' + rewrite_rule: + - '.* /index.html [END]' + - comment: 'frontend rewrites' + rewrite_rule: + - '^code/(modernizr-custom.js|spar-checker-min.css|spar-checker-min.js|selection.json)$ - [L]' + - '^code/(modernizr-custom|spar-checker-min|selection)-v[0-9]{1,4}\.(js|css|json)$ /code/$1.$2 [END]' + - '^media/(.*)-v[0-9]{1,4}\.(svg|jpg|png|gif)$ /media/$1.$2 [END]' + - '^media/(.*)\.(svg|jpg|png|gif)$ - [L]' + - '^code/.*\.(tmpl|eot|svg|ttf|woff|woff2)$ - [L]' + - '^((401|403|404|500)\.html)$ - [L]' + - '^(favicon-[0-9]{2}.ico)$ - [L]' + - '^(favicon-[0-9]{2}x[0-9]{2}.png)$ - [L]' + - '^(favicon.ico)$ - [L]' + - '^(sitemap.xml)$ - [L]' + - '^(robots.txt)$ - [L]' + - '^(manifest.json)$ - [L]' + - '^(browserconfig.xml)$ - [L]' + - '^(android-chrome-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(apple-touch-icon-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(apple-touch-icon-precompose.png)$ - [L]' + - '^(apple-touch-icon.png)$ - [L]' + - '^(mstile-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(opera_160.png)$ - [L]' + - '.* /404.html [R=404,L]' + - provider: location path: '/' limit_except: @@ -103,27 +134,31 @@ infra::profile::apache::pp_vhosts: - FollowSymLinks allow_override: - None - directoryindex: 'index.php index.html' - - provider: filesmatch - path: '\.(ttf|otf|eot|woff)$' - headers: - - 'always set Access-Control-Allow-Origin "*"' + directoryindex: 'index.php' +# alt +# rewrites: +# - comment: 'sfp files' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -d' +# rewrite_rule: +# - '^.*$ - [L]' +# - comment: 'sfp rebase' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' +# rewrite_rule: +# - '^(.*) - [E=BASE:%1]' +# - comment: 'sfp index' +# rewrite_rule: +# - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' +# neu rewrites: - - comment: 'sfp files' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -d' - rewrite_rule: - - '^.*$ - [L]' - - comment: 'sfp rebase' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' + - comment: 'sfp rewrites' rewrite_rule: - - '^(.*) - [E=BASE:%1]' - - comment: 'sfp index' - rewrite_rule: - - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' + - 'code/.*(css|js|eot|index.php|svg|ttf|woff|woff2)$ - [L]' + - '.* /sfp/index.php [END]' + - provider: directory path: '/var/www/spar-checker/sparchecker-backend/public/api/' addhandlers: @@ -132,23 +167,34 @@ infra::profile::apache::pp_vhosts: - FollowSymLinks allow_override: - None - directoryindex: 'index.php index.html' + directoryindex: 'index.php' +# rewrites: +# - comment: 'api files' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -d' +# rewrite_rule: +# - '^.*$ - [L]' +# - comment: 'api rebase' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' +# rewrite_rule: +# - '^(.*) - [E=BASE:%1]' +# - comment: 'api index' +# rewrite_rule: +# - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' +# neu rewrites: - - comment: 'api files' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -d' - rewrite_rule: - - '^.*$ - [L]' - - comment: 'api rebase' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' - rewrite_rule: - - '^(.*) - [E=BASE:%1]' - - comment: 'api index' + - comment: 'api rewrites' rewrite_rule: - - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' + - '^v1/[/[:alnum:]]{2,30}$ /api/index.php [END]' + - '.* /404.html [R=404,L]' + + - provider: filesmatch + path: '\.(ttf|otf|eot|woff)$' + headers: + - 'always set Access-Control-Allow-Origin "*"' rewrites: - comment: 'Alle Aliase auf Servername' rewrite_cond: diff --git a/customer/spk-spar-checker/test.yaml b/customer/spk-spar-checker/test.yaml index ab08ff7a..bc8e6f84 100644 --- a/customer/spk-spar-checker/test.yaml +++ b/customer/spk-spar-checker/test.yaml @@ -51,6 +51,7 @@ infra::profile::apache::pp_vhosts: - 'HTTPS on HTTPS=on' - 'X-Forwarded-For ^80.146.239.2 admin_ip_range' - 'X-Forwarded-For 192.168.15.1[89] admin_ip_range' + - 'X-Forwarded-For 130.180.83.190 admin_ip_range' error_documents: - { error_code: 401 , document: "/401.html" } - { error_code: 403 , document: "/403.html" } @@ -64,6 +65,37 @@ infra::profile::apache::pp_vhosts: allow_override: - None directoryindex: 'index.html' +# neu + custom_fragment: 'AddType text/plain .tmpl' + rewrites: + - comment: 'frontend root rewrite' + rewrite_cond: + - '%{REQUEST_URI} ^/$' + rewrite_rule: + - '.* /index.html [END]' + - comment: 'frontend rewrites' + rewrite_rule: + - '^code/(modernizr-custom.js|spar-checker-min.css|spar-checker-min.js|selection.json)$ - [L]' + - '^code/(modernizr-custom|spar-checker-min|selection)-v[0-9]{1,4}\.(js|css|json)$ /code/$1.$2 [END]' + - '^media/(.*)-v[0-9]{1,4}\.(svg|jpg|png|gif)$ /media/$1.$2 [END]' + - '^media/(.*)\.(svg|jpg|png|gif)$ - [L]' + - '^code/.*\.(tmpl|eot|svg|ttf|woff|woff2)$ - [L]' + - '^((401|403|404|500)\.html)$ - [L]' + - '^(favicon-[0-9]{2}.ico)$ - [L]' + - '^(favicon-[0-9]{2}x[0-9]{2}.png)$ - [L]' + - '^(favicon.ico)$ - [L]' + - '^(sitemap.xml)$ - [L]' + - '^(robots.txt)$ - [L]' + - '^(manifest.json)$ - [L]' + - '^(browserconfig.xml)$ - [L]' + - '^(android-chrome-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(apple-touch-icon-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(apple-touch-icon-precompose.png)$ - [L]' + - '^(apple-touch-icon.png)$ - [L]' + - '^(mstile-[0-9]{2,3}x[0-9]{2,3}.png)$ - [L]' + - '^(opera_160.png)$ - [L]' + - '.* /404.html [R=404,L]' + - provider: location path: '/' limit_except: @@ -78,8 +110,6 @@ infra::profile::apache::pp_vhosts: requires: - 'valid-user' - 'env admin_ip_range' -# - provider: location -# path: '/api' - provider: location path: '/sfp' auth_type: Digest @@ -100,23 +130,31 @@ infra::profile::apache::pp_vhosts: - FollowSymLinks allow_override: - None - directoryindex: 'index.php index.html' + directoryindex: 'index.php' +# alt +# rewrites: +# - comment: 'sfp files' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -d' +# rewrite_rule: +# - '^.*$ - [L]' +# - comment: 'sfp rebase' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' +# rewrite_rule: +# - '^(.*) - [E=BASE:%1]' +# - comment: 'sfp index' +# rewrite_rule: +# - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' +# neu rewrites: - - comment: 'sfp files' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -d' - rewrite_rule: - - '^.*$ - [L]' - - comment: 'sfp rebase' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' + - comment: 'sfp rewrites' rewrite_rule: - - '^(.*) - [E=BASE:%1]' - - comment: 'sfp index' - rewrite_rule: - - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' + - 'code/.*(css|js|eot|index.php|svg|ttf|woff|woff2)$ - [L]' + - '.* /sfp/index.php [END]' + - provider: directory path: '/var/www/spar-checker/sparchecker-backend/public/api/' addhandlers: @@ -125,23 +163,31 @@ infra::profile::apache::pp_vhosts: - FollowSymLinks allow_override: - None - directoryindex: 'index.php index.html' + directoryindex: 'index.php' +# alt +# rewrites: +# - comment: 'api files' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' +# - '%%{ich-trickse}{REQUEST_FILENAME} -d' +# rewrite_rule: +# - '^.*$ - [L]' +# - comment: 'api rebase' +# rewrite_cond: +# - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' +# rewrite_rule: +# - '^(.*) - [E=BASE:%1]' +# - comment: 'api index' +# rewrite_rule: +# - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' +# neu rewrites: - - comment: 'api files' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_FILENAME} -s [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -l [OR]' - - '%%{ich-trickse}{REQUEST_FILENAME} -d' + - comment: 'api rewrites' rewrite_rule: - - '^.*$ - [L]' - - comment: 'api rebase' - rewrite_cond: - - '%%{ich-trickse}{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$' - rewrite_rule: - - '^(.*) - [E=BASE:%1]' - - comment: 'api index' - rewrite_rule: - - '^(.*)$ %%{ich-trickse}{ENV:BASE}/index.php [L]' + - '^v1/[/[:alnum:]]{2,30}$ /api/index.php [END]' + - '.* /404.html [R=404,L]' + - provider: filesmatch path: '\.(ttf|otf|eot|woff)$' headers: