-
Notifications
You must be signed in to change notification settings - Fork 384
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
Support external POST forms via form submission proxy #4191
Comments
Please share the URL for the AMP page that has the form on it. |
Also, the console error is:
|
Thanks. I'm also seeing this: I can see that the HTTP response headers for a request are:
This is not expected. I expected instead of a |
Yes. That's the plugin I'm using. Once the form is submitted with the plugin and the user is subscribed, my mailing system redirects the user to https://thepostmansknock.com/welcome-to-the-blog-list/. Is that redirection not compatible with AMP? |
Oh, also I'm seeing the form having this action URL: https://thepostmansknock.boldermail.com/subscribe?_wp_amp_action_xhr_converted=1 That's not expected. Should it not rather be: https://thepostmanskck.staging.wpengine.com/subscribe?_wp_amp_action_xhr_converted=1 Have the URLs perhaps not been replaced properly on your staging site? The redirection should be compatible with AMP. In particular if the redirection is being done via You can see that the plugin intercepts calls to amp-wp/includes/class-amp-http.php Lines 342 to 370 in c4e7f12
|
The form sends the data there, the user is subscribed and then So there would not be any call to |
OK, the response from |
Ok, that makes sense! I just took a quick look at what the AMP for WordPress plugin does with forms. In one of their extensions, AMP Opt-in, they provide a form builder for 25 different companies (Mailchimp, Mailerlite, etc.) that redirects all actions to an AJAX request within the plugin. Then, the AJAX function actually submits the information to these companies. I think I'll have to implement something like this. Thanks for your help! |
Yes, implementing a proxy endpoint would work if you can't add the |
Actually I wonder if this proxy would make sense to be built directly into the AMP plugin. This would make the form submissions much less likely to fail, such as when sites don't use |
Submitting a form to an external URL to subscribe a user and then redirecting them back is something a lot of companies do (like Mailchimp). I have used the Genesis eNews Extended with Mailchimp before, and that was the process. However, I couldn't find any references to using AMP with a Mailchimp form besides the AMP for WordPress plugin and this gist: https://gist.github.com/pshapiro/3a1f5286ff98abd3bd3d7dbe3b5ff70d The AMP for WordPress plugin has this proxy as a paid extension. |
Okay, let me draft a PR to implement this. Would you test? |
Sure! |
@chvillanuevap I have a PR for you to test: #4212. See build of ZIP if you don't want to do a build yourself: #4212 (comment) |
I have also opened a PR to make Genesis eNews Extended AMP-compatible: kraftbj/genesis-enews-extended#146 |
Sure! I'll test today. |
Thanks y'all for your work here. I'll review the PR on the eNews Extended side and get it out. |
Hi All - I have a similar commenting issue on my site, which uses the native Wordpress Twenty Fifteen theme and the AMP Plugin. Website: https://www.darrenhuang.com/2020/03/seo-newsletter-issue-4.html I was about to submit a new issue but noticed this thread and decided to address it here. Is it the same issue and will be fixed in the same pull request? Thank you! |
@DarrenHuangTW Hey. The issue you have may be resolved by this, but there is another existing solution. Namely, the problem is that your server has in place strict Mod Security rules which reject requests that contain the query string parameter This has been reported before:
This was resolved by contacting the host to add the |
@westonruter Thank you for answering so quickly! I'll reach out to Bluehost to resolve it. :-) |
Another support topic about this issue: https://wordpress.org/support/topic/new-user-egisteration-getting-failed-in-standard-mode-of-amp/ |
What are the plans to merge this into the plugin? I just updated to version 1.5.5 because the version I downloaded initially (1.5.0-alpha-20200205T225235Z-b246797c6) was breaking the display of posts for logged in users. |
It's currently milestoned for v2.1. So hopefully in a couple months. |
This is also needed by the Revue widget in Jetpack: Automattic/jetpack#16922. |
Also let's make sure it accounts for the PayPal payment snippet code: https://wordpress.stackexchange.com/questions/367201/amp-and-paypal-form-cors-issue |
Hey guys it's going to be almost a year since I opened this ticket. Any chance of the solution seeing the light of day anytime soon? |
Not enough time to get this into 2.1, but I'm planning to create a mini plugin that implements the proxy in a standalone way to prototype it for 2.2. |
Sorry for the delay. I have put together a mini plugin that implements an external form submission proxy: https://gist.github.com/westonruter/c08134bf8b33a49ef780a70b337d456f Hopefully this is helpful while waiting to get this into the plugin. Please let me know if there are any issues. |
As opposed to creating a proxy, I've also written ampproject/amphtml#27638 (comment) to advocate non-XHR POST forms. This will save many headaches. |
Here is another alternative which utilizes an iframe to embed the external POST form: https://amp-external-subscription-form-in-iframe.glitch.me/ |
Hi there!
I'm using the Genesis eNews Extended plugin to create a form and have my website visitors subscribe to my newsletter. I recently noticed that when I use AMP, the form does not work at all. I get an error message that says: "Your submission failed. The server responded with (code ). Please contact the developer of this form processor to improve this message. Learn More"
Do I need to add some headers or something to a filter in functions.php? Or is this a server issue?
Thanks!
The text was updated successfully, but these errors were encountered: