V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
brucehuai
V2EX  ›  问与答

移动端 HTTP 307 错误

  •  
  •   brucehuai · 2019-01-16 19:33:34 +08:00 · 2183 次点击
    这是一个创建于 1920 天前的主题,其中的信息可能已经有所发展或是发生改变。

    各位大佬,小弟的 NG 代理了个网站,CONF 里没有 REWRITE 和重定向配置。

    现在遇到了一个移动端访问登录接口会报网络繁忙,打印日志是 HTTP 307

    请问有大佬遇到过这种问题吗?

    6 条回复    2019-01-17 10:22:10 +08:00
    Pastsong
        1
    Pastsong  
       2019-01-16 19:35:39 +08:00 via Android
    307 不是错啊,是 hsts 的跳转
    brucehuai
        2
    brucehuai  
    OP
       2019-01-16 19:35:43 +08:00
    CENTOS7 NG1.12 ,代理配置文件如下
    upstream erchtms_hy_server {
    server 172.168.0.122;
    }
    server {
    listen 80;
    server_name XXX 脱敏
    access_log /usr/local/nginx/logs/XXX.access.log;

    error_log /usr/local/nginx/logs/XXX.error.log;


    location =/ {
    proxy_pass http://172.168.0.79/XXX;
    client_max_body_size 100m;
    proxy_redirect off;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_
    proxy_max_temp_file_size 0;
    proxy_connect_timeout 1800;
    proxy_send_timeout 1800;
    proxy_read_timeout 1800;
    proxy_buffer_size 4k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    brucehuai
        3
    brucehuai  
    OP
       2019-01-16 19:36:39 +08:00
    @Pastsong 没有启用 HTTPS,只是默认的 HTTP/1.1
    抓包的时候出现 307 报错,就会导致手机出现 网络繁忙
    过 10 分钟又自动好了,很妖
    yhxx
        4
    yhxx  
       2019-01-16 19:38:00 +08:00
    开了 HSTS 吧
    brucehuai
        5
    brucehuai  
    OP
       2019-01-16 19:40:47 +08:00
    @yhxx 大佬,没有开
    NGINX.CONF

    #user nobody;
    worker_processes auto;
    worker_rlimit_nofile 65535;
    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    pid /var/run/nginx.pid;


    events {
    use epoll;
    worker_connections 65535;
    }


    http {
    include mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log logs/access.log main;

    sendfile on;
    tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;

    server_tokens off;
    gzip on;

    # 启用 gzip 压缩的最小文件,小于设置值的文件将不会压缩
    gzip_min_length 1k;
    # gzip 压缩级别,1-10,数字越大压缩的越好,也越占用 CPU 时间,后面会有详细说明
    gzip_comp_level 2;

    # 进行压缩的文件类型。javascript 有多种形式。其中的值可以在 mime.types 文件中找到。
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

    # 禁用 IE 6 gzip
    gzip_disable "MSIE [1-6]\.";

    include conf.d/*.conf;

    server {
    listen 80 ;
    }

    server {
    listen 80 default_server;
    server_name _;
    return 403;
    }
    }
    brucehuai
        6
    brucehuai  
    OP
       2019-01-17 10:22:10 +08:00
    只要手机上传任意附件,就会造成 307 问题,APP 访问出现网络繁忙
    有大佬指导一下吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1777 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:27 · PVG 00:27 · LAX 09:27 · JFK 12:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.