Cache purge has problem when both http&https scheme available


#1

When a visitor post comment.The Nginx Helper plugin only purge pages either on http or https.(depends on what scheme the visitor used)

We all know the http&https content is different.So there is no point to set a same key in ngx cache setting.

I tried to patch the plugin function myself by using these code:

function purgeUrl( $url, $feed = true ){  
	$this->purgeUrl1($url, $feed);  
	$pre_parse = parse_url($url);  
	if ( $pre_parse[ 'scheme' ] == "https" ){  
		$this->purgeUrl1(str_replace("https","http",$url),$feed);  
	}else{  
		$this->purgeUrl1(str_replace("http","https",$url),$feed);  
	}  
}  
function purgeUrl1( $url, $feed = true ) {  
...

It’s work perfectly when visitor post comment via http.But when visitor post comment via https,these codes will cause duplicate comment and die with ‘Duplicate comment detected’.

Pls consider this situation and fix this bug.


#2

update: I checked again.my patch code did not have error.it's actually work.Even i don't patch the function,the [Duplicate comment detected] error still have.And if i disable purge function,the error gone.


#3

In your case, I will recommend putting entire site on HTTPS so only page kind of page gets cached.

Nginx with entire site on SSL doesn't affect performance. You can tweak it using - https://rtcamp.com/tutorials/nginx/ssl-pci-compliance-performance/

In future versions, we will add support for purging multiple variations of page in Nginx-helper.


#4

It's not about performance.A major search engine at China called BaiDu did not support HTTPS.It's quite unbelievable but it's ture.I don't use baidu(baidu is a asshole) but it has 61.01% market share at China last month(Google has already quit from China,it's only has 1.18% market share).So I cannot let it go.

I still looking for what code cause "Duplicate comment detected".And i also know the purge function code may come from another plugins.I hope you can give some help.

Thx.


#5