admin-ajax.php 403 是不是因为缓存插件导致的


发布者 蔚蓝天空  发布时间 1619406365592
关键字 OnceOA 

  admin-ajax.php 是 WordPress 用于Ajax请求的必需文件,在使用缓存插件的情况下,如果你的网站使用了Ajax请求网站数据,可能会时不时出现 admin-ajax.php 403 的情况,怎样确定 admin-ajax.php 403 是不是因为缓存插件导致的呢?

  后台缓存插件中清空缓存,然后到浏览器中随便访问网站的一个页面,F12 打开调试模式。

  Ctrl + F5 强制刷新前台页面,发现 admin-ajax.php 可以正常加载,说明是缓存导致了问题。

  联想到通常使用Ajax时,我们都会使用 WordPress 内置的Nonce机制来添加请求安全验证。如果Nonce的值失效了,但是缓存仍在,就会出现请求被拒绝。

  Nonce 的默认有效期为24小时,所以,解决该问题的办法就是定时清空缓存,或者不要缓存admin-ajax.php请求。

  比如,如果你使用的是 WP Rocket 缓存插件,可以将 /wp-admin/admin-ajax.php 添加到排除路径中:

  如果使用的是 WP Fastest Cache 或 WP Super Cache 等缓存插件,可以设置一个时间自动清空缓存,比如 WP Fastest Cache 可以在【删除缓存】选项卡按照下图添加一个规则:每10小时清空一次全部缓存。

  其他缓存插件就不介绍了,总之就是找到自动清理缓存的设置选项,设置自动清理缓存的时间不超过12小时,应该就可以了。

dribbble.com/jkiea/collections/4673037
dribbble.com/jkiea/collections/4673034
dribbble.com/jkiea/collections/4673033
dribbble.com/jkiea/collections/4673031
dribbble.com/jkiea/collections/4673030
dribbble.com/jkiea/collections/4673028
dribbble.com/jkiea/collections/4673026
dribbble.com/bacvi/collections/4673060
dribbble.com/bacvi/collections/4673059
dribbble.com/bacvi/collections/4673058
dribbble.com/bacvi/collections/4673057
dribbble.com/bacvi/collections/4673056
dribbble.com/bacvi/collections/4673055
dribbble.com/bacvi/collections/4673052
dribbble.com/bacvi/collections/4673051
dribbble.com/bacvi/collections/4673050
dribbble.com/bacvi/collections/4673049
dribbble.com/bacvi/collections/4673047
dribbble.com/bacvi/collections/4673044
dribbble.com/caieu/collections/4673085
dribbble.com/caieu/collections/4673083
dribbble.com/caieu/collections/4673079
dribbble.com/caieu/collections/4673078
dribbble.com/caieu/collections/4673076
dribbble.com/caieu/collections/4673075
dribbble.com/caieu/collections/4673074
dribbble.com/caieu/collections/4673073
dribbble.com/caieu/collections/4673072
dribbble.com/caieu/collections/4673071
dribbble.com/zaiecu/collections/4673108
dribbble.com/zaiecu/collections/4673107
dribbble.com/zaiecu/collections/4673105
dribbble.com/zaiecu/collections/4673104
dribbble.com/zaiecu/collections/4673102
dribbble.com/zaiecu/collections/4673101
dribbble.com/zaiecu/collections/4673097
dribbble.com/zaiecu/collections/4673096
dribbble.com/zaiecu/collections/4673095
dribbble.com/zaiecu/collections/4673094
dribbble.com/zaiecu/collections/4673093
dribbble.com/zaiecu/collections/4673092
dribbble.com/cuiew/collections/4673132
dribbble.com/cuiew/collections/4673127
dribbble.com/cuiew/collections/4673126
dribbble.com/cuiew/collections/4673123
dribbble.com/cuiew/collections/4673122
dribbble.com/cuiew/collections/4673121
dribbble.com/cuiew/collections/4673118
dribbble.com/cuiew/collections/4673117
dribbble.com/cuiew/collections/4673114
dribbble.com/cuiew/collections/4673113
dribbble.com/cncjde/collections/4673147
dribbble.com/cncjde/collections/4673146
dribbble.com/cncjde/collections/4673145
dribbble.com/cncjde/collections/4673143
dribbble.com/cncjde/collections/4673142
dribbble.com/cncjde/collections/4673141
dribbble.com/cncjde/collections/4673140
dribbble.com/cncjde/collections/4673139
dribbble.com/cncjde/collections/4673138
dribbble.com/cncjde/collections/4673137
dribbble.com/yuies/collections/4673174
dribbble.com/yuies/collections/4673172
dribbble.com/yuies/collections/4673169
dribbble.com/yuies/collections/4673167
dribbble.com/yuies/collections/4673164
dribbble.com/yuies/collections/4673162
dribbble.com/yuies/collections/4673160
dribbble.com/yuies/collections/4673159
dribbble.com/yuies/collections/4673157
dribbble.com/yuies/collections/4673153
dribbble.com/cseiu/collections/4676998
dribbble.com/cseiu/collections/4676992
dribbble.com/cseiu/collections/4676985
dribbble.com/cseiu/collections/4676979
dribbble.com/cseiu/collections/4676974
dribbble.com/cseiu/collections/4676969
dribbble.com/cseiu/collections/4676963
dribbble.com/cseiu/collections/4676956
dribbble.com/cseiu/collections/4676951
dribbble.com/cseiu/collections/4676946
dribbble.com/nmecu/collections/4677328
dribbble.com/nmecu/collections/4677307
dribbble.com/nmecu/collections/4677291
dribbble.com/nmecu/collections/4677264
dribbble.com/nmecu/collections/4677250
dribbble.com/nmecu/collections/4677226
dribbble.com/nmecu/collections/4677203
dribbble.com/nmecu/collections/4677188
dribbble.com/nmecu/collections/4677171
dribbble.com/nmecu/collections/4677157
dribbble.com/jksia/collections/4691598
dribbble.com/jksia/collections/4691596
dribbble.com/jksia/collections/4691594
dribbble.com/jksia/collections/4691593
dribbble.com/jksia/collections/4691590
dribbble.com/jksia/collections/4691588
dribbble.com/jksia/collections/4691584
dribbble.com/jksia/collections/4691583
dribbble.com/jksia/collections/4691582
dribbble.com/jksia/collections/4691580
dribbble.com/jksia/collections/4691578
dribbble.com/nucei/collections/4691625
dribbble.com/nucei/collections/4691623
dribbble.com/nucei/collections/4691621
dribbble.com/nucei/collections/4691620
dribbble.com/nucei/collections/4691619
dribbble.com/nucei/collections/4691617
dribbble.com/nucei/collections/4691616
dribbble.com/nucei/collections/4691614
dribbble.com/nucei/collections/4691612
dribbble.com/nucei/collections/4691610
dribbble.com/nucei/collections/4691609
dribbble.com/nucei/collections/4691608
dribbble.com/bacio/collections/4691653
dribbble.com/bacio/collections/4691650
dribbble.com/bacio/collections/4691649
dribbble.com/bacio/collections/4691648
dribbble.com/bacio/collections/4691641
dribbble.com/bacio/collections/4691640
dribbble.com/bacio/collections/4691639
dribbble.com/bacio/collections/4691637
dribbble.com/bacio/collections/4691636
dribbble.com/bacio/collections/4691634
dribbble.com/bacio/collections/4691633
dribbble.com/bacio/collections/4691632
dribbble.com/uiwea/collections/4691689
dribbble.com/uiwea/collections/4691687
dribbble.com/uiwea/collections/4691681
dribbble.com/uiwea/collections/4691679
dribbble.com/uiwea/collections/4691677
dribbble.com/uiwea/collections/4691676
dribbble.com/uiwea/collections/4691675
dribbble.com/uiwea/collections/4691674
dribbble.com/uiwea/collections/4691670
dribbble.com/uiwea/collections/4691668
dribbble.com/uiwea/collections/4691665









  开源的 OurJS
OurJS开源博客已经迁移到 OnceOA 平台。

  关注我们
扫一扫即可关注我们:
OnceJS

OnceOA