nginx转发https请求到同一机器,浏览器报403,postman测试正常

Postman测试http状态码200,说明nginx转发位置应该没错。
浏览器不行报403错误,会不会是跨域问题?怎么解决?

img

img

img

403 错误是你没有权限访问吧

403是权限不足,需要在nginx配置文件中设置下跨域问题

是浏览器跨域问题,nginx设置一下,可参考:http://t.zoukankan.com/tinywan-p-8482093.html

是不是跨域了

修改nginx配置文件头部,添加以下内容

add_header 'Access-Control-Allow-Origin' 'http://im.tinywan.com';
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept';

重启Nginx服务

sudo systemctl restart openresty.service