technichdml
Forum Replies Created
-
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledHi @vmarko ,
latest Update of your plugin killed my hotfix as expected.
Can you and your dev team please consider to make
the check in redirect_on_foreign_domain() an option?
Remember my hotfix was if ($_SERVER[‘REQUEST_URI’] == ‘/wp-load.php’) return; in 1st Line one of that function.So if a user says “false” in backend that this host check is ignored?
For customers behind a AWS loadbalancer like me?
Option should be to choose if you want to have a
redirect_on_foreign_domain or not.Thank you for your time
Best FrankForum: Plugins
In reply to: [W3 Total Cache] .webp with CDNHi @vmarko
I hit the button “Save Settings & Purgae Caches” within “admin.php?page=w3tc_cdn” is that what you mean?
Had no effect.
I am wondering how AWS CloudFront should know to serve .webp instead of .jpg for example if the HTML markup at my webpage links to *.jpg and thus thats what is requested from CDN by bypassing NGINX rewrite rules.
Thanks alot
Best FrankForum: Plugins
In reply to: [W3 Total Cache] Enable cache purge via Amazon SNSHi @vmarko
great i am sorry i have not seen that. You can close the ticket.
I have gaved your plugin and support a 5 start rating btw.Thank you a lot!
Forum: Plugins
In reply to: [W3 Total Cache] Enable cache purge via Amazon SNSHi @vmarko yes i found that option already but my question is. Do you have some kind of tutorial how to set that stuff up at AWS to work together with your plugin?
If not just close the ticket please.
Thank you a lot.
Best FrankForum: Plugins
In reply to: [W3 Total Cache] Some files missing in CDN / how does *.gzip work?Hi @vmarko
im not sure. We are using the blocksy theme and your Plugin.
The CND files are just loaded by your plugin i defined 4 CNAMES but all point to the same S3 bucket behind CloudFront.My JavaScript knowledge is not good enough to debug this main.js.gzip stuff.
Do you have any idea what i have to change that also those files are loaded from CDN?
We prepare for hundreds of thousands visitors within minutes and it’s important for us that all static assest are loaded from the CDN.Thank you a lot!
Best FrankForum: Plugins
In reply to: [W3 Total Cache] Some files missing in CDN / how does *.gzip work?I just edited the reply. I will create a new thread for this latest reply. Can you please answer questions above?
Thank you a lot
Best Frank- This reply was modified 2 years, 10 months ago by technichdml.
- This reply was modified 2 years, 10 months ago by technichdml.
- This reply was modified 2 years, 10 months ago by technichdml.
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledHi @vmarko
i do not agree. It may be expected behavior for 99% of your customers but it makes your Page Cache practically unusable for people with an AWS Loadbalancer in front.
Its not ME requesting the WordPress website by IP its AWS Loadbalancer architecture, that is how its designed by Amazon.
It uses http requests after the LB to call the specific node backend IPs.If you have multiple nodes the loadbalancer looks which node is still healthy and only forwards requests to the healthy notes. So in this case everything would fail.
How else they should check if a specific instance is still available for requests when not by the IP of the instance?
They cant use the main domain they have to call each instance over HTTP by IP.
With the 301 redirect to Domainname it destroys the whole AWS Loadbalancer architecture, and i still do not got the reason. If i don’t want my Website to be called by IP i can still disallow that on webserver settings.
Of course i can write my own healthcheck but normally the purpose for a healthcheck is to check if the site still renders, the site as customers would request it.
Normally you would even use / (homepage) for healthchecks of a website to see if the mainpage does not report any error. My wp-load.php was already a workaround.
So IMHO you could/ should make that some kind of feature (Disable HOST check, Blacklist URLs, Healthcheck Whitelist or whatsoever)
I have a workaround for me now even if its not the best one.
So i am fine.Thanks a lot for your support. You may close that ticket now
Best
Frank- This reply was modified 2 years, 10 months ago by technichdml.
- This reply was modified 2 years, 10 months ago by technichdml.
- This reply was modified 2 years, 10 months ago by technichdml.
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledMore debugging and findings
Looks like i am right with function redirect_on_foreign_domain() causing the redirect and problem in my case.
As far as i understand:
That functions takes the WordPress Home URL defined (in my case https://hundemarmelade.de) and compares it with
the $request host. If the request comes from the AMAZON EBS loadbalancer healthcheck it is not https://hundemarmelade.de but
for example $request_host :172.30.2.193 as you can see in the nginx log files above.The following if conditions in function redirect_on_foreign_domain() will then recognize that the hosts do not match and create the redirect with the URL from get_home_url().
That also explains why if i call https://hundemarmelade.de/wp-loader.php from my browser the host matches and thus no redirect is created.
If i put
if ($_SERVER[‘REQUEST_URI’] == ‘/wp-load.php’) return;
at first line of the function EBS Loadbalancer reports healthy again and no redirect.But that cant be the fix? Also it would be gone everytime i update your plugin.
Whats the purpose of that function? Have you any idea how to fix this?
Thanks a lot
Best Frank- This reply was modified 2 years, 11 months ago by technichdml.
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledignore that &.#8221; postfix this is just a copy and paste error its hard to format source code pretty well here in this forum
- This reply was modified 2 years, 11 months ago by technichdml.
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledHi @vmarko
– not using WPMU.
– there is no wp-content/w3tc-config/blogs.php createdI made some more testing with enhanced nginx log_format
log_format main ‘$remote_addr – $remote_user [$time_local] “$host” “$request” ‘
‘”$request_method $scheme://$host$request_uri $server_protocol” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for” “$sent_http_location”‘;Now we see its the HTTPS redirect somehow:
Without Page cache enabled:
172.30.0.236 – – [27/Apr/2022:17:44:39 +0000] “172.30.2.193” “GET /wp-load.php HTTP/1.1” “GET https://172.30.2.193/wp-load.php HTTP/1.1” 200 31 “-” “ELB-HealthChecker/2.0” “-” “-”
172.30.2.92 – – [27/Apr/2022:17:44:40 +0000] “172.30.2.193” “GET /wp-load.php HTTP/1.1” “GET https://172.30.2.193/wp-load.php HTTP/1.1” 200 31 “-” “ELB-HealthChecker/2.0” “-” “-”With Page cache enabled:
`172.30.0.236 – – [27/Apr/2022:17:44:54 +0000] “172.30.2.193” “GET /wp-load.php HTTP/1.1” “GET https://172.30.2.193/wp-load.php HTTP/1.1” 301 5 “-” “ELB-HealthChecker/2.0” “-” “https://hundemarmelade.de/wp-load.php”
172.30.2.92 – – [27/Apr/2022:17:44:55 +0000] “172.30.2.193” “GET /wp-load.php HTTP/1.1” “GET https://172.30.2.193/wp-load.php HTTP/1.1” 301 5 “-” “ELB-HealthChecker/2.0” “-” “https://hundemarmelade.de/wp-load.php”So i see we have the 301 redirect here which causes the problem for me. But where does it come from?
Is it maybe function redirect_on_foreign_domain()
in wp-content/plugins/w3-total-cache/PgCache_Plugin.phpI will continue debuging…. Need this be solved else my whole cloud infrastructure does not work as planned ??
Thank you so much for your help!
Best Frank
- This reply was modified 2 years, 11 months ago by technichdml.
- This reply was modified 2 years, 11 months ago by technichdml.
Forum: Plugins
In reply to: [W3 Total Cache] AWS Elastic Loadbalancer Fails when Page Cache enabledHi @vmarko
thank you so far!
– no problems at the website problem just relates to EBS Loadbalancer failing healthchecks cause of the 301 status code.
– no redirect plugins , no rewrite rules in nginx except thoose created from your plugin
– AT EBS Loadbalancer you have to use HTTP thus i have thoose listener and processes:
https://snipboard.io/HIcKMg.jpg– also in wp-config.php its checked if requests comes from ELB or cloudfront. This is needed to make it work.
/** Detect if SSL is used. This is required since we are terminating SSL either on CloudFront or on ELB */ if ((@$_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] == 'https') OR (@$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) {$_SERVER['HTTPS']='on
Same for me i have no clue why this happens when i activate Page Cache. Makes no sense for me but i debugged it down that far.
Website URL is https::/hundemarmelade.de
Nginx.conf:
`location = /favicon.ico {
log_not_found off;
access_log off;
}location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
#try_files $uri $uri/ /index.php?q=$uri&$args;
#gzip_static on;
}# rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# BEGIN W3TC CDN
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css)$ {
expires 31536000s;
etag on;
if_modified_since exact;
add_header Pragma “public”;
add_header Cache-Control “public”;
add_header X-Powered-By “W3 Total Cache/2.2.1”;
add_header Referrer-Policy “no-referrer-when-downgrade”;
add_header Access-Control-Allow-Origin “*”;
}
# END W3TC CDN
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
location ~ (robots\.txt|[a-z0-9_\-]*sitemap[a-z0-9_\.\-]*\.(xml|xsl|html)(\.gz)?) {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.(css|htc|less|js|js2|js3|js4)$ {
expires 31536000s;
etag on;
if_modified_since exact;
add_header Pragma “public”;
add_header Cache-Control “public”;
add_header X-Powered-By “W3 Total Cache/2.2.1”;
add_header Referrer-Policy “no-referrer-when-downgrade”;
}
location ~ \.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$ {
expires 3600s;
etag on;
if_modified_since exact;
add_header Pragma “public”;
add_header Cache-Control “public”;
add_header X-Powered-By “W3 Total Cache/2.2.1”;
add_header Referrer-Policy “no-referrer-when-downgrade”;
}
location ~ \.(asf|asx|wax|wmv|wmx|avi|avif|avifs|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|_ttf|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
expires 31536000s;
etag on;
if_modified_since exact;
add_header Pragma “public”;
add_header Cache-Control “public”;
add_header X-Powered-By “W3 Total Cache/2.2.1”;
add_header Referrer-Policy “no-referrer-when-downgrade”;
}
add_header Referrer-Policy “no-referrer-when-downgrade”;
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
set $w3tc_rewrite 1;
if ($request_method = POST) {
set $w3tc_rewrite 0;
}
if ($query_string != “”) {
set $w3tc_rewrite 0;
}
if ($http_cookie ~* “(comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle)”) {
set $w3tc_rewrite 0;
}
set $w3tc_preview “”;
if ($http_cookie ~* “(w3tc_preview)”) {
set $w3tc_preview _preview;
}
set $w3tc_ssl “”;
if ($scheme = https) {
set $w3tc_ssl _ssl;
}
if ($http_x_forwarded_proto = ‘https’) {
set $w3tc_ssl _ssl;
}
set $w3tc_enc “”;
if ($http_accept_encoding ~ gzip) {
set $w3tc_enc _gzip;
}
set $request_uri_noslash $request_uri;
if ($request_uri ~ “(.*?)(/+)$”) {
set $request_uri_noslash $1;
}
location ~ “.*(?<!php)$” {
set $memcached_key “$http_host$request_uri_noslash/$w3tc_ssl$w3tc_preview$w3tc_enc”;
memcached_gzip_flag 65536;
default_type text/html;
if ($w3tc_rewrite = 1) {
memcached_pass 127.0.0.1:11211;
}
error_page 404 502 504 = @fallback;
}
location @fallback {
try_files $uri $uri/ $uri.html /index.php?$args;
}
# END W3TC Page Cache core- This reply was modified 2 years, 11 months ago by technichdml.
- This reply was modified 2 years, 11 months ago by technichdml.
- This reply was modified 2 years, 11 months ago by technichdml.
Forum: Themes and Templates
In reply to: [Blocksy] Issue with customizer contenti was able to find my problem due to your assistance.
After diffing the db table wp_options from both websites i found out i had an error in my search and replace script which processed the mysql dump.
For the record. I now use wp cli like this:wp search-replace “://myhost.com” “://staging.myhost.com”
which works like a charm.Thank you a lot!
Best FrankForum: Plugins
In reply to: [W3 Total Cache] AWS Cloudfront / S3 missing files / .gzip postfix?Hi @vmarko okay.
If i understood correctly the cache will not work but the site still being delivered.
You can close the thread. Thank you a lot!Forum: Plugins
In reply to: [W3 Total Cache] AWS Cloudfront / S3 missing files / .gzip postfix?Hi @vmarko
im not sure if understood your latest reply / function.
which basicaly mean that the CDN is tryin go load different file which does not exist on the server.
The files are stored in CDN without URL Parameter of course.
So should not be a problem?
Or is the CDN somehow pulling files?Is there anywhere a comprehensive documentation about all thoose gerat features in the plugin?
It’s kind of tricky even with a lot of IT knowledge.
For example i have questions like what happens i memcached server is not reachable anyore and more ??Thank you a lot!
Forum: Plugins
In reply to: [W3 Total Cache] AWS Cloudfront / S3 missing files / .gzip postfix?Update: I got it working after looking into the code of the plugin.
Seems like i missed the part that the files are loaded from CDN no matter if i uploaded them or not.
So it was just adding all those files into “Custom file list:”
Also looks like they have to be upload after compression was activated to have the compressed once as well. I did it before.Thanks for your help!
- This reply was modified 2 years, 11 months ago by technichdml.