You can add cache control header inside your controller
* This action render random number for each request
public function execute()
$page = $this->pageFactory->create();
//We are using HTTP headers to control various page caches (varnish, fastly, built-in php cache)
If you cannot change the headers values, you can do as follows:
Import these classes:
Implement CsrfAwareActionInterface :
class MyApi extends \Magento\Framework\App\Action\Action implements ...
Your URLs come from Magento 2's router system, which can be configured per module. This means that not all the admin controllers are in one place, example:
https://mysite/admin/admin/export/export/key/xxx/entity/catalog_product/file_format/csv comes from module magento/module-import-export
https://sysite/admin/admin/dashboard/index/key/xxx/ comes from ...
You can increasing the following PHP settings (php.ini) for doing imports:
post_max_size = 128M
as suggested in some articles about import...
After setting them back to default (64M)
post_max_size = 64M
and ,naturally, deleting all the cache folders under /var/cache/, everything went back to normal.
in php we use POST and GET method for submit data
if we use POST method then form data will be submit in Form data parameter when you come back from browser that time it will not call your controller for Action directly submit form Again based on Form data parameter so you will get Error like
Confirm Form Resubmission
Suggest you to use GET method ...
This isn't Magento causing an error, rather your browser (Chrome) warning you that you are resubmitting the exact same data in a (POST) request. Firefox does the same:
It's not isolated to Magento sites either, any site that you press the browser back button in after making a POST request will warn you of the same.
you can add your data in below code
One approach is to use the registry so in your controller class you put it in the registry, and then in your block you can retrieve it.
class Index extends Action
public function __construct(