1
0
mirror of https://github.com/trambarhq/relaks-wordpress-example.git synced 2025-09-02 12:42:38 +02:00

Fixed cache purge (issue #50).

Fixed permalinks with date (issue #49).
This commit is contained in:
Chung Leong
2019-02-03 14:20:43 +01:00
parent 7b381cbd42
commit d94aca4ae4
4 changed files with 24 additions and 38 deletions

View File

@@ -128,14 +128,14 @@ async function handlePurgeRequest(req, res) {
// verify that require is coming from WordPress
let remoteIP = req.connection.remoteAddress;
res.end();
let wordpressIP = await dnsCache.lookupAsync(WORDPRESS_HOST.replace(/^https?:\/\//));
let wordpressIP = await dnsCache.lookupAsync(WORDPRESS_HOST.replace(/^https?:\/\//, ''));
if (remoteIP !== `::ffff:${wordpressIP}`) {
return;
}
let url = req.url;
let method = req.headers['x-purge-method'];
if (method === 'regex' && url === '.*') {
if (method === 'regex' && url === '/.*') {
pageDependencies = {};
await NginxCache.purge(/.*/);
} else if (method === 'default') {