Happens when I go to any product page in the back office.
I can access the default store view. I can access the first store view.
But I can't access the second store view without triggering that error :
The error: Invalid security or form key Please refresh the page
Already tried to upgrade max_input_vars
from 1000 to 5000 in php.ini
Any idea?
EDIT : So in fact after further investigation, this is the real reason behind all that so the provided answers is different from the linked one.
Here is what happened :
I had an observer on layout load before running.
<event name="layout_load_before">
<observer name="redirectcustomer_success" instance="Cpy\CheckUrl\Observer\RedirectCustomer" />
</event>
That observer was meant to redirect users trying to access my 'pro' store...and it worked properly in frontside.
Sadly I didn't planed that...changing the store view in back office would also trigger the condition of that observer. Looks like for magento; even being on BO; the store is considered as the pro store.
Which mean my current error comes from the fact I'm trying to redirect to the front side from the back office cause I'm entering this condition in my observer
public function execute(Observer $observer){
$loginRedirectUrl = $this->getCustomerLoginUrl();
$currentUrl = $this->_urlInterface->getCurrentUrl();
$fullActionName = $this->request->getFullActionName();
$currentStoreCode = $this->storeManager->getStore()->getCode();
$isStorePro = $currentStoreCode == 'pro';
if($isStorePro){
if(!$this->_customerSession->isLoggedIn()
&& $currentUrl != $loginRedirectUrl
&& $fullActionName != 'customer_account_forgotpassword'
&& $fullActionName != 'customer_account_createpassword'
&& $fullActionName != 'customer_account_create'
&& $fullActionName != 'customer_section_load') {
$resultRedirect = $this->responseFactory->create();
$resultRedirect->setRedirect($loginRedirectUrl)->sendResponse('200');
exit();
}
}
}
Not sure yet of what is the best way to handle things but still this is the real reason behind this issue.