Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with (redis) cache #120

Closed
ppc1337 opened this issue Feb 4, 2017 · 8 comments
Closed

Not working with (redis) cache #120

ppc1337 opened this issue Feb 4, 2017 · 8 comments

Comments

@ppc1337
Copy link

ppc1337 commented Feb 4, 2017

Hey guys,

I discovered webmentions a few weeks ago and implemented it succesfully on my site. But I also wanted a little backward compability for those, who are not using webmentions and are working with pingbacks. For this case I implemented also the webmention.io-fallback (and tested a lot with pingen from one of my posts to another one of my posts)

While that I noticed, that the self-pings are only working when I clear the whole cache of my site.

For better understanding: I'm using Wordpress on a nginx-server and the redis cache sits in front of the site. So when a visitor comes, a check is running if the whole html of the targeted site is in the redis cache. If yes, its presented - if not, the user is forwarded to the worpress-site.

I'm not a developer, but was wondering, why with the deactivated plugin the normal pingbacks are working with the cache - and with the activated webmention-plugin the pingbacks are not working.

Can anyone explain this behaviour or help with my problem?

@dshanske
Copy link
Collaborator

dshanske commented Feb 4, 2017

How did you implement the webmention io fallback?

@ppc1337
Copy link
Author

ppc1337 commented Feb 4, 2017

This way:

<link rel="pingback" href="https://webmention.io/webmention?forward=https://www.wihel.de/wp-json/webmention/1.0/endpoint />
<link rel="webmention" href="https://webmention.io/www.wihel.de/webmention" />

based on this explanation:

https://indieweb.org/pingback

Update: the code is placed in the header.php

@dshanske
Copy link
Collaborator

dshanske commented Feb 4, 2017

@ppc1337 Webmention.io is an external webmention handler. The Webmention plugin has its own built-in webmention handler. So you don't need webmention.io for webmentions. You are declaring that your webmention handler is webmention.io. Which means that site would store it. Since the Webmention plugin doesn't support reading from webmention.io, the data would not come to your site.

Now, if you wanted to just use their pingback to webmention gateway, that would be the first line only. But you'd need to remove all references to the xmlrpc.php gateway on your site from your theme. There are two ways to do this.

  1. Remove it by hand and replace.
  2. As of WordPress 4.7, remove by filter. This is from memory...
function change_pingback( $output, $show ) {
 if ( 'pingback_url' === $show ) {
     $output = "https://webmention.io/webmention?forward=https://www.wihel.de/wp-json/webmention/1.0/endpoint";
 }
return $output;
}

add_filter( 'bloginfo_url', 'change_pingback', 10, 2);

I did want to write that as a simple plugin someday that would also disable pingback handling by xmlrpc...like this below. Maybe I will someday.

add_filter( 'xmlrpc_methods', 'remove_xmlrpc_pingback_ping' );function remove_xmlrpc_pingback_ping( $methods ) {unset( $methods['pingback.ping'] );return $methods;} ;

@ppc1337
Copy link
Author

ppc1337 commented Feb 4, 2017

@dshanske thanks for your quick reply - makes sense to me and I will check it late at the day. One more question: do I have to use webmention.io or is there a way I can use webmentions with the webmention-plugin and pingbacks at the same time - maybe with

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

which was already placed in the themes header? I'm not sure, but for me it looks like that the webmentions-plugin is replacing the pingback-stuff in wordpress with the webmention-functionality (with my first tests last weekend I noticed, that the webmentions worked, but not the pingbacks anymore - thats the reason I was looking for a solution to run webmentions and pingbacks parallel)

@dshanske
Copy link
Collaborator

dshanske commented Feb 4, 2017

Webmentions the plugin does not interfere with Pingbacks in any way. Both can be run in parallel. The only commonality is that Webmentions uses the Pingbacks Open setting in WordPress.

You do need the pingback header you mentioned. Webmentions puts in the headers automatically. WordPress does not put in pingback headers and relies on the theme to do that due backward compatibility issues.

@ppc1337
Copy link
Author

ppc1337 commented Feb 4, 2017

@dshanske Alright, thank you a lot!

@pfefferle
Copy link
Owner

can we close this?

@ppc1337
Copy link
Author

ppc1337 commented Mar 6, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants