首页 > nginx配置后访问不到主动ajax请求?

nginx配置后访问不到主动ajax请求?

server {
        listen 80;
        server_name 127.0.0.1;

        access_log      /var/log/nginx/survey_access.log;
        error_log       /var/log/nginx/survey_error.log;

        location /public/ {
                root /home/kevin/nodeSrc/expressSrc/surveyProject;
        }


        location / {
                proxy_pass http://127.0.0.1:3000;
        }

}

访问首页 127.0.0.1 能成功显示,但在首页有个自动的ajax请求是 127.0.0.1/JS_GetPage_Record 这个请求一直502,不通过nginx反代都正常 如果手动去点按钮触发这个按钮返回是正常的


以下为解决方法

html

$('#tbl_list_index').bootstrapTable({
                url: '/JS_GetPage_Record', 
                method: 'post', 
                contentType: "application/x-www-form-urlencoded",
                striped: true, 
                cache: false, 
                pagination: true, 
                sortable: false, 
                sortOrder: "asc", 
                queryParams: function (params) {
                    return {
                        pageSize: params.limit,
                        pageIndex: params.offset
                    }
                },
                sidePagination: "server", 
                pageNumber: 1, 
                pageSize: 30,
                pageList: [30, 40, 50, 100], 
                strictSearch: true,
                clickToSelect: true, 
                //height: 600, 
                uniqueId: "Id", 
                cardView: false, 
                detailView: false, 
                smartDisplay: false,
                columns: [...] //省略
            });

这是html里ajax打开首页自动请求的语句,查看信息 X-Powered-By:nginx1.6.2 一看就是还没到express里面,所以nginx配置加上,成功请求!

 location /JS_GetPage_Record {
                proxy_pass http://127.0.0.1:3000/JS_GetPage_Record;
        }

但是不理解为何,主动请求nginx不继续往下请求,难道每条自动请求都要写入nginx配置?


今天一测 又不好使了


直接访问 http://127.0.0.1/JS_GetPage_Record 出来什么

【热门文章】
【热门文章】