Closed tomkiss closed 2 years ago
OK.
This is caused with a bad site configuration - in this instance, when the site's Base URL
was not defined (once was, no idea when that got wiped!).
Anyway, rubber ducking against the internet has worked! 🐤🙌
Hi, running into the same issue at the moment. I checked my general.php config and there seems to be a base URL in place. Are you maybe talking about another base URL i'm forgetting about?
'siteUrl' => getenv('SITE_URL'),
Many thanks in advance! ✌️
Hi, running into the same issue at the moment. I checked my general.php config and there seems to be a base URL in place. Are you maybe talking about another base URL i'm forgetting about?
'siteUrl' => getenv('SITE_URL'),
Many thanks in advance! ✌️
This error will happen when redactor receives an empty link. Hence, you can easily recreate it with the following HTML markup in the redactor field:
<p><a href="">Link</a></p>
So if you're using Redactor to make an entry link or similar, then its likely your config is returning an empty value for the base url. Head to Settings > Sites > [Your default site] > Base URL to check its value.
The siteUrl config setting you mention has been deprecated as of Craft 3.6.
Either way, maybe Redactor should be more defensive about this.
This indeed did the trick for me. Was working on a slightly older project and had upgraded craft without thinking about it too much. Forgot about the deprecated config setting! My bad, should be more mindful when upgrading.
Thanks a lot 😁
I have the same issue (with empty a tags or with url) but it persists even after updating the config settings which are now set to:
'aliases' => [ '@web' => getenv('DEFAULT_SITE_URL'), ],
and in admin/settings/sites/1 the Base URL is set to @web
@markodamis Sanity check but what is your env var of DEFAULT_SITE_URL
set to? If it's undefined, null or empty the error will still occur.
Of course ... DEFAULT_SITE_URL="http://site.localhost"
on local and DEFAULT_SITE_URL="http://www.site.come"
on production. ...
@markodamis Hmmm, I'm not sure then - I would start by hard-coding a value in the offending link (i.e, hard-coding a value for the Base URI
or Entry URI Format
in the settings for the section/asset/other you're linking to in Redactor) and see where that gets you to.
@tomkiss In the redactor field I am linking to google.com.
I am experiencing the same Issue as described in the initial issue. As an addition: entrylinks and assetlinks work just fine, but links to an external page cause the posted internal server error.
Tested if entrylinks and assetlinks work and they do. The issue is with links to external pages like Mathieu explained.
FYI: With relative Links you can save, so if you want to have a hacky workaround:
This has been fixed in craftcms/html-field
1.0.9 (for Craft 3) and 2.0.5 (for Craft 4). You can get the fix by running composer update
.
I'm on Craft 4.2.1.1 and craftcms/html-field
2.0.5.
I'm still running into the 403 Error, whether I add a relative or external link in a redactor Field and attempt to save (the ajax call also receives the 403). If I "unlink" the text it saves successfully.
This issue happens on all of my environments except on my local instance, which has http://localhost as my base URL. My Base URL is set accordingly for each environment as an environment variable. I've tried using the env variable or typing out the actual site URL in the CP Settings but the error persisted. I can update other Fields and Matrix Blocks fine. But it must be a server setting since it works on localhost. Any guidance would be much appreciated.
Description
Got a weird bug I'm seeing when saving entries sometimes.
It's very sporadic and I can't seem to repro on a blank project. Seems to appear when changing the contents of a Redactor field. It's occurring when links are in Redactor fields. Craft and all plugins are up to date.
Assuming I might need to send over a copy of the DB or something.
Additional info
Error:
Apache/2.4.46 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141 PHP/7.4.16 OpenSSL/1.0.2u mod_wsgi/3.5 Python/2.7.13 Yii Framework/2.0.44```
Video of the issue failing to auto-save when a link is present:
https://user-images.githubusercontent.com/183310/152540123-2dccc4a0-ff98-404c-9e55-68aaf614e049.mp4
Redactor config:
This happens across both Matrix fields using this Redactor config, and in standalone Redactor fields.