-
Notifications
You must be signed in to change notification settings - Fork 620
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
[4.x]: URL passthrough rewrite failing when using actionInput #15041
Comments
Rather than using a nested |
Hi Brad, I've tried this, but it doesn't fix the problem. Any other ideas? |
Hm, that’s surprising. What happens? |
I'm still getting /[Object HTMLInputElement]?GOOGLE_STRING I tested it with a "user/login" form. It doesn't work then.
|
Sorry, that’s not what I meant. I’m saying remove the <form method="post" class="checkout-form needs-validation" accept-charset="UTF-8"
action="{{ actionUrl('users/login') }}"
>
{{ csrfInput() }}
{{ redirectInput(CHECKOUT_ADDRESS_URL) }} |
Hi Brandon, sorry for the late reply, but this works. Thanks! |
Sweet, glad to hear! |
This is an issue for me on Craft 5 too... @brandonkelly what you suggested is not working for me, I switched password reset form from
to
The errors simply switches from 403 to page not found, since the server tries to load this address:
You can test it here: https://sale.colombomilano1911.com/shop/customer/forgot-password |
Any suggestion on this? I'm kinda lost on how to handle this thing, if it's related to some bug on craft or if the matter is totally guilt of GA. |
I just tested that locally and it worked, so I’m guessing it’s more of a server configuration issue.
@masiorama Just tested on your site, and I get a 404 response from I just tested your code snippet locally, and the |
Does the form work locally for you? |
Sorry, I didn't mention: you have to accept cookies to switch GA tracking on (due to GDPR here in Italy).
Well, your simple question pointed me to this: since locally (dev env) I do not include tracking scripts I am not sure, so I will turn it on and debug. I thought, as you do, that the problem is server misconfiguration so it didn't come to my mind, but I will check on dev env just to confirm that theory. Thanks, I will keep you posted. |
Hi @brandonkelly sorry for the delay, hectic days recently. I will work in the next couple of days and keep you posted. |
@brandonkelly I get the same behavior on local dev.
In this scenario you should get the 404, as this are not working (without google tracking we get .
So the point is that with that google stuff appended on the url Craft is not able to correctly read the route, am I right? I have no clue if my hypotesis could be right or even if I was able to explain my idea in proper english. Thanks for any hint/help/idea. |
Hello, sorry to bother @brandonkelly any thoughts on this? Just to point me to the right direction (more exclude an option). |
@masiorama Just got around to looking into that again. I’m not sure exactly what the problem is, but it’s not with the You can verify by opening your Network tab, then submitting the form, then inspecting the 404 request, and creating a new fetch('https://sale.colombomilano1911.com/index.php?p=actions/users/send-password-reset-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
CRAFT_CSRF_TOKEN: '...',
redirect: '...',
loginName: 'you@domain.com'
})
}) When you submit it, you’ll get the same 404 response back. So something on your server isn’t handling POST requests to action URLs properly, it seems. |
Thenks @brandonkelly I will dig into it and keep you posted. |
What happened?
Description
Got this from: https://craftcms.stackexchange.com/questions/41657/url-passthrough-rewrite-failing-when-using-actioninput
We are experiencing some issues with form submissions on websites that are using action inputs.
If a visitor denies analytics_storage via a cookie consent plug-in. Google Tagmanager will start using the URL passthrough function to pass the GCLID and other data otherwise stored in cookies by rewriting all URL's on a page.
This rewriting also happens on form submissions and will try to change the "action" attribute on the submitted form. To do this, the Google JavaScript tries to read the action parameter of the form and that's where things go wrong. Reading the action attribute of a form that's using the actionInput tag returns the complete HTMLInputElement instead of the action string. And Google appends that complete object to the rewritten action attribute. Resulting in a form that's submitted to: "/[Object HTMLInputElement]?GOOGLE_STRING". Which obviously doesn't work.
Contacting Google about this issue seems like a pretty lost cause. But is there any way to solve this in our website or Google Tagmanager settings without disabling the URL passthrough?
Steps to reproduce
Craft CMS version
4
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: