-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved we-retail filter and dispatcher-mount script (#17)
* improved we-retail filters * Linking enable* files in dispatcher-mount + dedicated domain name for we-retail * add we-retail to /etc/hosts * Fix: Publish farm not copied properly in dispatcher-mount * allow flushing from localhost
- Loading branch information
Showing
13 changed files
with
336 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
|
||
.DS_Store | ||
/.idea/ | ||
logs/ | ||
*.iml | ||
.DS_Store | ||
|
||
# do not check in files generated by dispatcher-mount | ||
logs/ | ||
cache/ | ||
**/enabled_vhosts | ||
**/enabled_farms | ||
|
||
# do not check in samples | ||
**/conf.d/available_vhosts/weretail.vhost | ||
**/conf.dispatcher.d/filters/weretail_filters.any | ||
**/conf.dispatcher.d/available_farms/weretail_publish_farm.any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
ams/2.6/etc/httpd/conf.dispatcher.d/available_farms/100_weretail_publish_farm.any
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/weretail-publishfarm { | ||
## client headers which should be passed through to the render instances | ||
## (feature supported since dispatcher build 2.6.3.5222) | ||
/clientheaders { | ||
$include "/etc/httpd/conf.dispatcher.d/clientheaders/ams_publish_clientheaders.any" | ||
$include "/etc/httpd/conf.dispatcher.d/clientheaders/ams_common_clientheaders.any" | ||
} | ||
## hostname globbing for farm selection (virtual domain addressing) | ||
/virtualhosts { | ||
we-retail | ||
we-retail.docker.local | ||
} | ||
## the load will be balanced among these render instances | ||
/renders { | ||
$include "/etc/httpd/conf.dispatcher.d/renders/ams_publish_renders.any" | ||
} | ||
## only handle the requests in the following acl. default is 'none' | ||
## the glob pattern is matched against the first request line | ||
/filter { | ||
$include "/etc/httpd/conf.dispatcher.d/filters/weretail_filters.any" | ||
} | ||
## if the package is installed on publishers to generate a list of all content with a vanityurl attached | ||
## this section will auto-allow the items to bypass the normal dispatcher filters | ||
## Reference: https://docs.adobe.com/docs/en/dispatcher/disp-config.html#Enabling%20Access%20to%20Vanity%20URLs%20-%20/vanity_urls | ||
#/vanity_urls { | ||
# /url "/libs/granite/dispatcher/content/vanityUrls.html" | ||
# /file "/tmp/vanity_urls" | ||
# /delay 300 | ||
#} | ||
## allow propagation of replication posts (should seldomly be used) | ||
/propagateSyndPost "0" | ||
## the cache is used to store requests from the renders for faster delivery | ||
## for a second time. | ||
/cache { | ||
## The cacheroot must be equal to the document root of the webserver | ||
/docroot "${PUBLISH_DOCROOT}" | ||
## sets the level upto which files named ".stat" will be created in the | ||
## document root of the webserver. when an activation request for some | ||
## handle is received, only files within the same subtree are affected | ||
## by the invalidation. | ||
/statfileslevel "${DEFAULT_STAT_LEVEL}" | ||
## caches also authorized data | ||
/allowAuthorized "0" | ||
## Flag indicating whether the dispatcher should serve stale content if | ||
## no remote server is available. | ||
/serveStaleOnError "1" | ||
## the rules define, which pages should be cached. please note that | ||
## - only GET requests are cached | ||
## - only requests with an extension are cached | ||
## - only requests without query parameters ( ? ) are cached | ||
## - only unauthorized pages are cached unless allowUnauthorized is set to 1 | ||
/rules { | ||
$include "/etc/httpd/conf.dispatcher.d/cache/ams_publish_cache.any" | ||
} | ||
# the invalidate section defines those pages which are 'invalidated' after | ||
# any activation. please note that, the activated page itself and all | ||
# related documents are flushed on an modification. for example: if the | ||
# page /foo/bar is activated, all /foo/bar.* files are removed from the | ||
# cache. | ||
/invalidate { | ||
/0000 { | ||
/glob "*" | ||
/type "deny" | ||
} | ||
/0001 { | ||
/glob "*.html" | ||
/type "allow" | ||
} | ||
} | ||
/allowedClients { | ||
## By default block all IP from allowing to initiate the invalidation commands | ||
/0000 { | ||
/glob "*.*.*.*" | ||
/type "deny" | ||
} | ||
## Allow certain IP's like publishers to invalidate cache | ||
$include "/etc/httpd/conf.dispatcher.d/cache/ams_publish_invalidate_allowed.any" | ||
} | ||
## Cache response headers next to a cached file. On the first request to | ||
## an uncached resource, all headers matching one of the values found here | ||
## are stored in a separate file, next to the cache file. On subsequent | ||
## requests to the cached resource, the stored headers are added to the | ||
## response. | ||
## Note, that file globbing characters are not allowed here. | ||
/headers { | ||
"Cache-Control" | ||
"Content-Disposition" | ||
"Content-Type" | ||
"Expires" | ||
"Last-Modified" | ||
"X-Content-Type-Options" | ||
} | ||
## By default we want to cache every page regardless if it has a query parameter. | ||
## For pages that render html differently based on the query parameters | ||
## please add entries to deny the caching of those query parameters in this section | ||
/ignoreUrlParams { | ||
/0001 { /glob "*" /type "allow" } | ||
} | ||
|
||
# A grace period defines the number of seconds a stale, auto-invalidated | ||
# resource may still be served from the cache after the last activation | ||
# occurring. Auto-invalidated resources are invalidated by any activation, | ||
# when their path matches the /invalidate section above. This setting | ||
# can be used in a setup, where a batch of activations would otherwise | ||
# repeatedly invalidate the entire cache. | ||
/gracePeriod "2" | ||
|
||
## Enable TTL evaluates the response headers from the backend, and if they | ||
## contain a Cache-Control max-age or Expires date, an auxiliary, empty file | ||
## next to the cache file is created, with modification time equal to the | ||
## expiry date. When the cache file is requested past the modification time | ||
## it is automatically re-requested from the backend. | ||
# /enableTTL "1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ | |
/glob "${PUBLISH_IP}" | ||
/type "allow" | ||
} | ||
/02 { | ||
/glob "127.0.0.1" | ||
/type "allow" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
docker kill dispatcher | ||
docker kill mydispatcher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
docker exec -it dispatcher /bin/bash | ||
docker exec -it mydispatcher /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
docker run -p 80:8080 -p 443:8443 -itd --rm --name dispatcher --env-file scripts/env.sh dispatcher | ||
docker run -p 80:8080 -p 443:8443 -itd --rm --name mydispatcher --env-file scripts/env.sh dispatcher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
## Collect any enviromental variables that are set in /etc/sysconfig/httpd | ||
## Collect the dispatchers number | ||
PassEnv DISP_ID | ||
|
||
<VirtualHost *:80> | ||
## allowing slashes in the URL to be encoded and still honored | ||
AllowEncodedSlashes On | ||
ServerName we-retail | ||
## Put names of which domains are used for your published site/content here | ||
ServerAlias we-retail.docker.local | ||
|
||
|
||
## Use a doc root that matches what's in the /etc/httpd/conf/publish-farm.any | ||
DocumentRoot ${PUBLISH_DOCROOT} | ||
## Add header breadcrumbs for help in troubleshooting | ||
<IfModule mod_headers.c> | ||
Header always add X-Dispatcher ${DISP_ID} | ||
Header always add X-Vhost "publish" | ||
Header merge X-Frame-Options SAMEORIGIN "expr=%{resp:X-Frame-Options}!='SAMEORIGIN'" | ||
Header merge X-Content-Type-Options nosniff "expr=%{resp:X-Content-Type-Options}!='nosniff'" | ||
#### Make sure proxies don't deliver the wrong content | ||
Header append Vary User-Agent env=!dont-vary | ||
## Force SSL for author | ||
## Add HSTS for avoiding man in the middle during browser redirect to SSL | ||
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;" | ||
</IfModule> | ||
<Directory /> | ||
## Update /etc/sysconfig/httpd with setting the PUBLISH_WHITELIST_ENABLED from 0 or 1 to enable or disable ip restriction rules | ||
<If "${PUBLISH_WHITELIST_ENABLED} == 1"> | ||
Include /etc/httpd/conf.d/whitelists/*_whitelist.rules | ||
</If> | ||
<IfModule disp_apache2.c> | ||
## Some items cache with the wrong mime type | ||
## Use this option to use the name to auto-detect mime types when cached improperly | ||
ModMimeUsePathInfo On | ||
## Use this option to avoid cache poisioning | ||
## Sling will return /content/image.jpg as well as /content/image.jpg/ but apache can't search /content/image.jpg/ as a file | ||
## Apache will treat that like a directory. This assures the last slash is never stored in cache | ||
DirectorySlash Off | ||
## Enable the dispatcher file handler for apache to fetch files from AEM | ||
SetHandler dispatcher-handler | ||
</IfModule> | ||
Options FollowSymLinks | ||
AllowOverride None | ||
#### Insert filter | ||
SetOutputFilter DEFLATE | ||
#### Don't compress images | ||
SetEnvIfNoCase Request_URI \ | ||
\.(?:gif|jpe?g|png)$ no-gzip dont-vary | ||
</Directory> | ||
<Directory "${PUBLISH_DOCROOT}"> | ||
AllowOverride None | ||
Require all granted | ||
</Directory> | ||
<IfModule disp_apache2.c> | ||
## Enabled to allow rewrites to take affect and not be ignored by the dispatcher module | ||
DispatcherUseProcessedURL 1 | ||
## Default setting to allow all errors to come from the aem instance | ||
DispatcherPassError 0 | ||
</IfModule> | ||
<IfModule mod_rewrite.c> | ||
ReWriteEngine on | ||
LogLevel warn rewrite:info | ||
##Global rewrite include | ||
Include /etc/httpd/conf.d/rewrites/base_rewrite.rules | ||
## Update /etc/sysconfig/httpd with setting the PUBLISH_FORCE_SSL from 0 or 1 to enable or disable enforcing SSL | ||
<If "${PUBLISH_FORCE_SSL} == 1"> | ||
Include /etc/httpd/conf.d/rewrites/xforwarded_forcessl_rewrite.rules | ||
</If> | ||
</IfModule> | ||
</VirtualHost> |
Oops, something went wrong.