2
votes

This is my first experience with GC instances and load balancers. I have a Compute Engine instance running a basic WordPress site with nginx. It's doing fine. I added a HTTP(S) load balancer as https. Run some tests, and all is well. Turned on the Cloud CDN, seems to work fine initially (though its for me to verify this via logging). Yesterday I noticed a redirect was not working properly. I fixed that 24+ hours ago with nginx. If I bypass the load balancer and go direct to the server, the "fix" has worked since then, consistently. If I request via the load balancer (with curl), I am getting the same bad results as yesterday. I have invalidated the entire cache from the CDN. Waited a few hours, no change. Then completely removed the CDN option from the load balancer. It has been over 2 hours now since then, and still I am getting the cached URL as I was yesterday. From what I've read, Google is using the Cache-control header, which is quite short. Bad request headers:

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 30 Mar 2018 20:48:34 GMT
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
Vary: Accept-Encoding, Cookie
Cache-Control: max-age=3, must-revalidate
Strict-Transport-Security: max-age=31536000;includeSubdomains
Via: 1.1 google
Transfer-Encoding: chunked

What I am missing?

1
My question clearly states that I have done the invalidation. And further, completely removed Cloud CDN from the loadbalancer. BTW, the cached content is still unchanged now after several days. Sounds like broken implementation of either loadbalancing or CDN.Hal Burgiss
If you try opening the site in incognito mode, does it still shows up as 24 hours ago?Katie Sinatra
Yes. I am using curl on command line primarily to avoid browser related issues. Thx.Hal Burgiss

1 Answers

0
votes

OK, silly me, it was not a caching issue at all. Red herring leading to trail of tears. Nginx redirect sytnax just plain works differently behind the GC load balancer.

Original redirect rule that I had altered (works fine going direct to server but NOT at all via load balancer):

rewrite ^(.*) https://www.example.com$request_uri? permanent;

Adding this statement just below that line now works both via load balancer and not:

if ($http_x_forwarded_proto = "http") { 
    return 301 https://www.example.com$request_uri; 
 }

That is still a mystery to me, but I have my life and sanity back.