mirror of
https://github.com/trambarhq/relaks-wordpress-example.git
synced 2025-09-02 12:42:38 +02:00
@@ -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') {
|
||||
|
Reference in New Issue
Block a user