debugging - 为什么这个 404 超时?
问题描述
有人可以解释为什么页面超时需要 30 秒吗?根据 Chrome 的调试器,它正在等待 404。
我不明白。如果是 404,为什么不立即返回 page not found 呢?
有问题的 nginx 配置看起来像这样
# redirect http to https
server {
listen ${API_PORT} default_server;
listen [::]:${API_PORT} default_server;
server_name example-api.${SITE_SUFFIX};
return 301 https://$host$request_uri;
}
server {
set $indexhtml 'index.html';
# port to example on. Can also be set to an IP:PORT
listen 8443 ssl;
# sets the domain[s] that this vhost server requests for
server_name example.${SITE_SUFFIX};
ssl_certificate /certs/example.${SITE_SUFFIX}/fullchain.pem;
ssl_certificate_key /certs/example.${SITE_SUFFIX}/privkey.pem;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 4G;
keepalive_timeout 10;
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
return 405;
}
root /var/www/frontend/public;
error_page 404 @404;
include conf.d/sites/content.conf;
# error page location redirect 302
location @404 {
return 302 /404;
}
}
server {
# port to example on. Can also be set to an IP:PORT
listen 8443 ssl;
# sets the domain[s] that this vhost server requests for
server_name sl.example.${SITE_SUFFIX};
ssl_certificate /certs/sl.example.${SITE_SUFFIX}/fullchain.pem;
ssl_certificate_key /certs/sl.example.${SITE_SUFFIX}/privkey.pem;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 4G;
keepalive_timeout 10;
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
return 405;
}
error_page 404 @404;
include conf.d/sites/sh.conf;
# error page location redirect 302
location @404 {
return 302 /404;
}
}
更新
这是超时后的样子。
解决方案
推荐阅读
- c# - 为什么“IQueryable.Where()”在此查询中提供与“IEnumerable.Where()”不同的结果?
- r - 在多个线程中使用 caret::trainControl 是否安全?
- elasticsearch - 在 ElasticSearch 中将双精度数组转换为密集向量
- python - Django - 将 SQLite 迁移到远程计算机上的 Postgre DB (Heroku)
- bitbucket-pipelines - 具有多个分支的 Bitbucket 管道
- c# - 如何将 InstancePerLifetimeScope 对象注入到 ASP.NET 之外的 SingleInstance 对象中?
- c# - User.Identity.GetUserId() 如何在 ASP.NET MVC5 中工作
- ng2-smart-table - 如何在行之间插入间隙?
- html - 使用 HTML5 登录单击按钮后保存信息
- python - 开始制作游戏,一切正常,但移动功能停止工作