CSRF in Mautic - Invalid CSRF Token Error - mautic

I get this error every time I try to do anything in Mautic, e.g. Save a form, change password, etc. I have just migrated and updated Mautic into a new environment, based on the official mautic/mautic image from Dockerhub. I also changed the domain name.
Correct error message:
CSRF token error. Try to refresh the page and try again.
Here are some things I've tried to fix this:
Clear cache
Change username and password of the admin user, clear cache
Added session.save_path = /var/php_sessions/ to php.ini, clear cache
Delete browser cookies, clear cache
php app/console mautic:update:find
php app/console mautic:update:apply
php app/console doctrine:migration:status
php app/console doctrine:migration:migrate
php app/console doctrine:schema:update --dump-sql
php app/console doctrine:schema:update --env=prod --force
php app/console cache:clear * 1000 times
Checked mymautic.com/s/sysinfo for error messages(fixed all errors)
Checked folder permissions, all green in the Folder & File Permissions tab
Delete cache directory
Yes, kind of some tricks ol' Google tipped me about. Now I'm out of ideas.
Or maybe 2 ideas left, because I changed the domain name, the CSRF-token is not happy :( how do I fix?
Or, Because I'm using Nginx as a loadbalancer so that the CSRF token gets lost on the way(But I was using the same setup before 🤔).
Been trying to solve this for like 5 hours now, going mad. Gonna take a break from that now and hopefully some fellow stackoverflower has some nice brainstorming ideas.

Ok, I found my error. After migrating I accidentally overwrote the new media/js/app.js with the old one. 🤦🏻‍♂️

Related

typo3 website move to other domain - need help step by step

I just got a typo3 website and need to transfer to an other domain.
Is it enough to copy all the folders (except typo3temp?) to the new place?
First I just changed baseurl in ts but it didn't do anything..
Should I do anything with the database when it still on the same server?
In case your question is about "cloning" a complete TYPO3-system an rsync/copy of the whole folder (yes including typo3temp) is the best idea, as this works on all versions, everything else (like excluding typo3temp) depends a whole lot on your TYPO3 expertise to resolve. The database needs to be copied as well. If you need to change db-name or db-credentials on the new system you need to change them in
typo3conf/LocalConfiguration.php
As soon as you have done this Install Tool and Backend should work: At first try the Install Tool:
https://my.new.domain/typo3/install/
If that doesn't work your problem is with the webserver configuration or dns.
If that works (and the reports there show no errors), try the Backend:
https://my.new.domain/typo3/
In case your question is about which changes are necessary to your TYPO3-installation if domain changes and the web server itself is configured correctly, then there are probably two things you need to change, in order to make the frontend work (although both cases might be omitted, depending on your configuration):
sys_template record, if any of those use absRefPrefix or baseurl. If you have access to the MySQL-Database a
SELECT pid FROM sys_template WHERE config LIKE "%baseurl%" OR "%absRefPrefix";
might help finding the template, however these template configuration might also be stored in files (typically in fileadmin/templates/**)
sys_domain records, a MySQL
SELECT pid FROM sys_domain;
might uncover where those are stored
However these changes are only necessary to enable the frontend to work.
Add a domain record in the backend. And while you don't need the content of the typo3temp folder, make sure the folder actually exists.
When you go to the new domain name in your browser, what happens?
Do you get redirected to the old domain? If so, maybe there is an .htaccess redirect happening.
Do you get to the new domain, but if you click on a link end up on the old one?
Do you get an error? If so, what is the error?
Does something else happen?

Umbraco installation wizard Error - Could not connect to database

I'm trying to install Umbraco on an ASP.NET environment. After I downloaded the umbraco nuget package I tried to run the installation wizard, by building and running the project. All is fine and good, if i take the default database configuration, but if I want to customize my configuration, it fails and says :
"Could not connect to database"
I'm trying to configure it to use my local SQLExpress database, but I just cannot get it working. I have both tried putting in the server information and connecting via. a connection string, via. the wizard. It produces the same error every time.
I have made a database called umbracoblog and created an admin user, with credentials. He has dbowner etc. for the database. Besides that, I have also given full permissions to IIS_IUSRS and Network Service accounts for the project and all subdirectories, and it still doesn't work.
These are some of the connection strings I have tried:
datalayer=SqlServer;Data Source=.\SQLExpress;Initial Catalog=umbracoblog;User Id=admin;Password=********;
datalayer=SqlServer;Data Source=127.0.0.1\SQLExpress;Initial Catalog=umbracoblog;User Id=admin;Password=*******;
I have also tried putting in the connectionstring into the web.config, manually, but that just makes the project load infinitely in the browser, when I run it.
It's starting to get frustrating, that I cannot even get past the configuration of Umbraco, because it look very cool. I have tried everything I was able to found online. Have anyone gone through this and know what I need to do ?
Start again - clear out and remove the umbracoDbDSN connection string entirely from your web.config and reset the umbracoConfigurationStatus AppSetting back to empty if it has been populated.
Use the Wizard to configure the database - if it's still having problems connecting then here's a few things to check:
Check the Log file here: ~/App_Settings/Logs/UmbracoTraceLog.txt - does that show up any errors?
Make sure you can connect to the database using other clients - if Umbraco can't connect to it, chances are something else won't be able to as well.
What happens if you use Integrated Authentication? If that works, then it's most likely an issue with the username and password you specified.
The password I had for the SQL Server user had a character that the installation UI didn't accept. I changed the password to remove special characters and it was able to connect to the server again. I could successfully log in through SSMS with the previous password.

Magento - dev server - url doesn't work

I am attempting to set up Magento on my Dev Server, but I can't get the URL to work.
I have a copy of the live version, which I installed. I then updated the config.xml file, emptied the cache folder (var/cache) and updated core_config_data with the new URL, but for some reason I am still getting redirected to the live URL rather than the Dev URL which I just configured.
Any ideas or help would be greatly appreciated.
If non of the other answers here, about ensuring ALL the values are set correctly in the database, are correct, it might be that the var/cache directory wasn't writable. In which case you would need to clear your cache in the system temp directory (/tmp/magento/ on most *nix based systems).
As an alternative, check your .htaccess file and ensure your live domain isn't referred to at all (RedirectRules, Redirect etc.).
In Your Development Server Database has the Live Server Url.
Just find and replace the Live server Url with Development Server Url in Dev server Database.
Example:
Live Server :
http://live-server.com
Development server :
http://dev-server.com
You Just Find the http://live-server.com in Development server Database And replace with http://dev-server.com.
It would be helpful to you.
Did you try clearing the session folder?
Go to phpmyadmin, execute this query and correct found values.
SELECT * FROM (SELECT * FROM `core_config_data` WHERE path LIKE "%url%") AS A
If you go to the database, look for core_config_data table. You need to change the value of web/unsecure/base_url and web/secure/base_url to your dev server url.
You may need to clear the cache on ./var/cache
Oops. :) I found my own issue...
Apparently I had a copy of the live file in app/etc/local.xml as backup_local.xml
However, the application loads all files which have the .xml extension - so it was loading the backup_local.xml file as well... Oops!
I hope this catch helps other users with a similar issue!

MODx Parse Error on home page

I've been having this error over lot of modx evolution 1.0.5 installations (I allways use 1&1 servers, in Linux version) It fails to load the home page (not any other pages) it seems that every time I clean the cache, via the manager or via API code, it creates again this file in the cache:
docid_1.pageCache.php
But the thing is that even if the folder cache and all the files inside are set to 777 permissions when it creates files for caching they have any permission set and that's the thing causing this error.
Anybody has had this error? I've been searching in MODX forums but didn't find anybody worried about this, but still I can see it's something happening a lot since when I search on google this error, I don't find forum posts discussing this but instead lots of modx frontend pages showing this error at their home pages.
Maybe it's a problem with 1&1 PHP configuration.
I'm really worried about this cose it has happen some times when I client calls me "über mad" complaining about his home page showing this error.
I've seen that new 1.06 version has some fix on the pagecache parser but I don't know if it's related to my problem.
Here's the error page:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the
requested resource: « PHP Parse Error »
PHP error debug Error: file(assets/cache/docid_1.pageCache.php) [function.file]: failed to open stream: Permission denied
Error type/ Nr.: Warning - 2
File: /homepages/3/d405318697/htdocs/t3st/manager/includes/document.parser.class.inc.php
Line: 413
Line 413 source: $flContent= implode("", file($cacheFile));
The cheeky answer? - "upgrade" Evolution is dead.
A more helpful answer, check the modx system settings, in Revolution you can tell modx what permissions to attempt to set on files, my guess is that maybe you have inadvertently set these to 000 if that's what you mean by this: "they have any permission set"
If that does not work/you get desperate, disable all caching and test or if possible [still not familiar with evo] set that resource to not be cached.
Though something odd is going on, please confirm; the index page will be cached but with no permissions i.e. 000, subsequent pages will be cached but do have correct permissions set? i.e. 666 [or 644/whatever]

gitorious install won't login

I have installed a copy of Gitorious on my own server. Everything so far seems to be okay except the fact I can't login. Any attempt to login(with correct credentials), from multiple browsers, just throws me back to the main page. Logging in with wrong password will just clear password box. What could be causing this?
I found the issue resolution here:
http://groups.google.com/group/gitorious/browse_thread/thread/e377597c0cd774b7
I had to change my host in config from localhost to my domain name.

Resources