-
Notifications
You must be signed in to change notification settings - Fork 638
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]: UrlHelper::actionUrl
returning wrong host
#14440
Comments
|
The request is made to: The generated url is: |
Go to |
SERVER_NAME is set to |
Thanks! Was able to reproduce, and agree it’s not expected behavior. Fixed for the next release. |
4.8.1 is out now with that fix. |
@brandonkelly Hey, on my craft site frontend and control panel are running under different domains. www.example.com and cms.example.com Your change now leads to various URL's pointing to the CP and no longer to the frontend which leads to many problems. (sprig tries to load its components via the CP, commerce payment redirects suddenly run via the control panel etc.) I have set What exactly can I do here? Is this a configuration problem? |
We also have It seems like maybe adding
|
(Or just don't set it at all, and let Craft set it automatically. That’s only a security concern if you are setting a site URL based on it, which you should definitely not be doing if your CP lives on a different hostname.) |
@brandonkelly Thx for your support! That fixed my issues |
What happened?
Description
I'm working on a headless commerce shop and using a custom payment gateway. In that gateway i use the function
UrlHelper::actionUrl
for the return url.Steps to reproduce
omitScriptNameInUrls
but don't change the pathParam.UrlHelper::actionUrl
from a non cp url in my case/actions/commerce/payments/pay
Expected behavior
Returns a url with the host pointing to `@web´.
Actual behavior
Returns an url with the host being the site.
I think the issue lies here:
cms/src/helpers/UrlHelper.php
Lines 623 to 625 in a89994c
cpuUrl
gets set by actionUrl to true because headlessMode is active but then get's ignored in the call tostatic::host
.Temporary fix
set pathParam to null
Craft CMS version
Craft Pro 4.7.3
PHP version
8.2
Operating system and version
Darwin 23.2.0
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: