Leo*_*lli 7 nginx ios safari http2
我的 NGINX 服务器上的 HTTP2 协议有问题,这是我的配置
listen 443 ssl http2;
server_name adomain.com;
root /var/www/project;
limit_req zone=one burst=60 nodelay;
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains;" always;
ssl_certificate /etc/letsencrypt/live/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
resolver 8.8.8.8;
ssl_stapling on;
ssl_stapling_verify on;
keepalive_timeout 70;
Run Code Online (Sandbox Code Playgroud)
我在我的 iOS 设备(safari 11)上看不到错误,很奇怪网页是一个 SPA(angular),应用程序向 API 发出请求,应用程序通过 HTTP2 加载,但是当应用程序必须向API 失败,禁用listen
HTTP2 使一切正常
两个服务器前端/后端的密码相同
在 Chrome/Firefox/IE 中工作正常,我不知道 Safari 或我的服务器配置有什么问题
Safari 失败时 error.log 和 adomain-error.log 为空
nginx版本
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
Run Code Online (Sandbox Code Playgroud)
更新
我的 iPhone 上的控制台说,Protocol error
所以我很确定这是 IOS 11 的错误
更新 2
我找到了这个帖子
https://www.nginx.com/blog/http2-theory-and-practice-in-nginx-stable-13/
Run Code Online (Sandbox Code Playgroud)
它解释说,如果你支持 TLSv < 1.2,你最终会得到一个PROTOCOL ERROR
,在我的服务器配置中只留下 TLSv1.2 使应用程序再次运行,但它有问题,一些请求会失败......这超出了我的理解,再次在Chrome/Firefox 可以正常工作,但在我的移动 Safari 中却没有
更新 3 [2019/02/28]
我们的 NGINX 配置中存在一个错误,用于 CORS 请求的 OPTIONS 方法,导致响应重复的Content-Length和Content-Type标头,在我们解决应用程序在 HTTP/2 中开始正常工作后,我们还更改了状态从 200 到 204 的 OPTIONS 响应
小智 -3
我遇到了类似的问题,我在 Windows 2008 R2 上使用 Apache,并h2
为所有虚拟主机启用并使用mod_http2
iOS 11 无法与服务器正确通信,导致协议错误。http2
修复方法是在服务器端禁用或http
恢复到https
.
归档时间: |
|
查看次数: |
3529 次 |
最近记录: |