我有用于REST API的woocommerce的wordpress,wordpress在docker上运行。对于http客户端,我在Laravel应用程序中使用Guzzle6和Oauth libs来执行请求。 laravel应用程序在nginx后面运行当我将base_url设置为localhost:port时,我得到了401
响应
{
"code":"woocommerce_rest_authentication_error",
"message":"Invalid signature - provided signature does not match.
}
当我将base_url设置为我的public ip
时,它成功了。当我在我的本地机器上开发它成功使用localhost作为base_url为什么会发生这种情况?
WooCommerce试图在localhost上发送一个简单的GET
请求和postman,我遇到了同样的问题。我通过将WP_HOME
和WP_SITEURL
设置为我的本地IP地址来修复它,或者转到Admin Panel > Settings > General
并用localhost
和WordPress Address (URL)
的ip地址替换Site Address (URL)
,如下所示:https://wordpress.stackexchange.com/questions/180207/how-to-make-other-computer-in-local-network-see-my-theme
希望这可以帮助。