最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Wordpress 403 error on form submission with Ajax

programmeradmin3浏览0评论

I have a wordpress multisite set up, and in my sub-site (called "team" site) I have buddypress. There is an activity stream, but I cannot post updates to the activity because there is a 403 error. When I click "submit" on a post and inspect the error, this is what I see on the network tab:

Request URL: https://<<masked>>.sg/team/wp-admin/admin-ajax.php
Request Method: POST
Status Code: 403
Remote Address: <<masked by me>>.31.79.150:443
Referrer Policy: no-referrer-when-downgrade

And when I check the actual response tab, this is the message:

The link you followed has expired. https://<<masked>>.sg/team/ Please try again.

What could be causing this problem? I cannot replicate this error on my local host.

I have a wordpress multisite set up, and in my sub-site (called "team" site) I have buddypress. There is an activity stream, but I cannot post updates to the activity because there is a 403 error. When I click "submit" on a post and inspect the error, this is what I see on the network tab:

Request URL: https://<<masked>>.sg/team/wp-admin/admin-ajax.php
Request Method: POST
Status Code: 403
Remote Address: <<masked by me>>.31.79.150:443
Referrer Policy: no-referrer-when-downgrade

And when I check the actual response tab, this is the message:

The link you followed has expired. https://<<masked>>.sg/team/ Please try again.

What could be causing this problem? I cannot replicate this error on my local host.

Share Improve this question edited Jun 20, 2020 at 11:44 Gaurav asked Jun 20, 2020 at 11:38 GauravGaurav 236 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

the issue was to do with cookies. In a multi-site setup, the cookies that are set upon user login depends on which subsite the user logged in from; not all cookies give equal authority to submit forms. so the solution is either you (a) change your cookie domain to one common one in wp_config.php - in which case a user can log in anywhere and the cookies will be fine, or (b) have a redirect so that there is only one site that users can log in from. Because of my unique setup, I opted for (b)

发布评论

评论列表(0)

  1. 暂无评论