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;
}
}
Accessing the home page 127.0.0.1 can be successfully displayed, but there is an automatic ajax request on the home page 127.0.0.1/JS_GetPage_Record. This request always gets 502, and it is normal without nginx reverse generation. If you click the button manually to trigger this button, the return is normal. of
The following is the solution
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: [...] //省略
});
This is the automatic request statement in html when ajax opens the homepage. Check the information. X-Powered-By:nginx1.6.2 It seems that it has not yet entered express, so the nginx configuration is added, and the request is successful!
location /JS_GetPage_Record {
proxy_pass http://127.0.0.1:3000/JS_GetPage_Record;
}
But I don’t understand why, when actively requesting nginx, it does not continue to make further requests. Does every automatic request have to be written into the nginx configuration?
I took a test today and it didn’t work again
某草草2017-05-16 17:18:49
Directly access http://127.0.0.1/JS_GetPage_Record and what will come out