New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http请求被转成https请求并报400错误 #854
Comments
这个根据你得描述没有想到很合理的解释
注意ssl on会将整个virtual server都开启成ssl,比如如下配置,即使
|
你好,非常感谢你的热心帮助,不过我想描述的问题并不是这样的。 |
这个和文件加载顺序有关( 通过 这个展开的配置中第一个server{}(如果没有配置listen default_server参数,第一个server{}块是默认server) 中 的 我举个例子解释下:
|
BTW,nginx配置中有listen指令其实是层级是要高于server{} 的。 这会导致 不同server{}中相同 默认server{}: 可以用listen的default_server参数控制,如果listen指令没有设置该参数,则含有相同
|
这个特点在做SNI切换的时候也导致了一些坑,SSL_CTX切换不干净
… On 29 Dec 2016, at 17:16, Xiaochen Wang ***@***.***> wrote:
BTW,nginx配置中有listen指令其实是层级是要高于server{} 的。
因为listen的fd的连接的属性其实是要先于7层数据包中的server_name属性(对应http请求中Host字段)。
这会导致 不同server{}总相同listen <ip>:<port>配置只受默认server{}的控制。
默认server{},可以用listen的default_server参数控制,如果没有配置这个参数,则是含有相同listen <ip>:<port>配置的各个server{}块中第一个server{}块。
listen文档 <http://nginx.org/en/docs/http/ngx_http_core_module.html#listen>
The default_server parameter, if present, will cause the server to become the default server for the specified address:port pair. If none of the directives have the default_server parameter then the first server with the address:port pair will be the default server for this pair.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#854 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAwyxldgId3ZaoINSkzJ3ZeD9FC5fF71ks5rM3pkgaJpZM4LVJM0>.
|
hi @InfoHunter
凯神多照顾下Tengine:) 好些SSL issue我处理起来特别费劲。 |
insteresting |
有些服务器确实是这样,可能是客户端https请求Host头字段加了端口 |
关闭中,如仍有问题可以重新打开 |
我今天也碰到了这个问题,不过我的是nginx,很奇怪,还没找到原因 |
但是并不想去掉ssl on,只想把所有http请求都转发为通过https访问 |
问题描述:在配置SSL之后,没有配置SSL的域名使用HTTP访问会走HTTPS请求,并且返回400报错,报错如下
400 Bad Request
The plain HTTP request was sent to HTTPS port. Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
环境描述:
我使用的是tengine-2.1.2,主配置文件加上如下参数include /opt/nginx/conf.d/*.conf;
比如域名有:pay-m.goywzl.com与pay.m.goywzl.com和callback.m.zhaopin.com与callback-m.goywzl.com
配置文件为:文件名在前,server_name在括号中
pay-m.conf(pay-m.goywzl.com)
pay.m.conf(pay.m.goywzl.com)
callback.m.conf(callback.m.goywzl.com)
callback-m.conf(callback-m.goywzl.com)
分别在pay-m.conf与callback-m.conf下添加如下配置
listen 443 ssl;
ssl on;
ssl_certificate /data/goywzl-certificate/goywzl.com.crt;
ssl_certificate_key /data/goywzl.com-certificate/goywzl.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers XXXXXXXXXXXXXXXXXXXXXXX
其它的配置与普通配置文件并没有差别,但是在使用http访问pay.m.goywzl.com等本tenginx所在的所有域名的时候,就会出现上面的错误,最后发现一个原因,只要我把配置文件名callback-m.conf随便改成不是callback-m这样的名字,如(callbackm.conf)里面的内容不变,就不会在出现上面的报错,并且从网上查到一些文档,如果我继续使用callback-m.conf这个名字,把配置文件内容"ssl on "这一行注释掉,就也恢复了正常200状态,但是其它的配置文件使用"SSL"配置是完全没问题的,只有这个配置文件名字有问题,实在想不出问题的原因,所以在这里请教各位,希望能知道是为什么会出现这个情况?
The text was updated successfully, but these errors were encountered: