最近项目从http升级至https后,原来app中短信的访问连接采用http请求的,现在以上线。我的nginx中判断如果是80端口请求的全部301至https的443端口,但是此时如果改的话,需要重新发布app,所以,采用办法是将这个连接过滤,别301跳转了。
具体做法如下:
判断如果不是/parking000/00000000Phone4Phone这个连接的话,301至https。如果是这个连接的话,继续执行location中的proxy_pass
server { listen 80; # listen [::]:80; server_name www.domain.com; access_log /var/log/nginx/listen80; if ($document_uri != '/parking000/00000000Phone4Phone'){ return 301 https://www.domain.com$request_uri; } location /parking000/ { index index_tel.jsp index.jsp index.html index.htm *.css; proxy_pass http://parking000; } }