-
Notifications
You must be signed in to change notification settings - Fork 125
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
Allow modification of accepted HTTP methods in the router #393
Comments
Could you provide a real life example of this? Do you have a plugin in mind you want to write that requires this? |
Sure - On WordPress.com (both the site itself, and all of our users sites), we run a tool called the community translator. It provides a front end interface to GlotPress. As logged in users to WordPress.com are already logged in to translate.glotpress.com (our GW install, soon to be using the plugin version) they can submit translations of WordPress.com or their theme using that tool. ( The Community Translator communicates with some custom endpoints in our GP install, see https://github.com/Automattic/gp-extended-api-plugins/blob/rewrite/translations-wordpress-plugin/gp-translation-extended-api/gp-translation-extended-api.php ) However, since some of these requests originate from different domains, we need to enable cross-site requests. To do that, we do the following:
|
Thanks. I'm not sure it would make sense to have this in core, but I could certainly see supporting a filter for the array of http methods to let a plugin alter it. So instead of:
have:
|
@toolstack Thanks - updated the PR |
This will probably be superseded by #338, but since there is no progress yet I'm fine with a filter for the meantime. |
The updated PR looks good. |
Use case: a GP plugin that allows Cross-Origin requests. Chrome precedes this with an HTTP OPTIONS request, which is currently filtered by the whitelist of http methods.
The text was updated successfully, but these errors were encountered: