Skip to content
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

bug: using the http to https plug, https redirects appear with 301 or 308 #11751

Open
wzhlinux opened this issue Nov 18, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@wzhlinux
Copy link

wzhlinux commented Nov 18, 2024

Current Behavior

My route configuration
{ "name": "smarteye-he-microapp.gwm.cn-/*", "host": "smarteye-he-microapp.gwm.cn", "plugins": { "redirect": { "http_to_https": true, "ret_code": 302, "append_query_string": false, "encode_uri": false } }, "uri": "/*", "status": 1, "id": "00000000000000001159", "labels": { "env": "test", "founder": "xxx", "applicant": "xxxx", "appkey": "xxx" }, "priority": 1, "enable_websocket": true, "upstream_id": "00000000000000001157" }

access_log:
{"time": "15/Nov/2024:23:57:02 +0800","remote_addr": "10.248.67.29","host": "smarteye-he-microapp.gwm.cn","status": "301","request_uri": "/","request_method": "GET","request_time": "0.000","request_length": "209","body_bytes_sent": "241","bytes_sent": "441","upstream_addr": "-","upstream_status": "-","upstream_response_length": "-","upstream_response_time": "-","server_name": "_","server_protocol": "HTTP/1.0","http_referer": "-","remote_user": "-","http_user_agent": "-","http_x_forwarded_for": "154.213.184.43, 10.248.65.252","tcpinfo_rtt": "133253","tcpinfo_rttvar": "28516","tcpinfo_snd_cwnd": "10","tcpinfo_rcv_space": "7300","connection": "10116981417","connection_requests": "1","scheme": "https","ssl_session_reused": ".","ssl_cipher": "ECDHE-RSA-AES128-GCM-SHA256"}

Expected Behavior

use https request host,redirects 301 or 308
Remove redirects plugins Restoring health。

Error Logs

Unexpected error log

Steps to Reproduce

Some business feedback, but failed to reproduce

Environment

  • APISIX version (run apisix version): 3.2.2
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@dosubot dosubot bot added the bug Something isn't working label Nov 18, 2024
@wzhlinux
Copy link
Author

Found the problem, it's caused by this line of code。use scheme
local proxy_proto = core.request.header(ctx, "X-Forwarded-Proto") local _scheme = proxy_proto or core.request.get_scheme(ctx) if conf.http_to_https and _scheme == "http" then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant