Nginx snooping port 443 is followed by apache snooping 8443, apache returns 301, how does nginx handle it correctly?

nginx listens to 443j Apache listeners 8443.

nginx configuration

server {
  listen 443;
  -sharp server_name *.ht920.com ht920.com;
  server_name www.ht920.com;
  ssl on;
  ssl_certificate   cert/1523974750873.pem;
  ssl_certificate_key  cert/1523974750873.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  location / {
    index index.html index.htm index.php;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass https://localhost:8443;
  }
  access_log logs/ht920.com_access.log;
}
The

phenomenon is:
I visit https://www.ht920.com/e/admin/ normal access,
access https://www.ht920.com/e/admin does not work. Will jump to https://www.ht920.com:8443/e/admin/

I visited curl-k https://localhost:8443/e/admin
on the server and got the result:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>

The document has moved <a href="https://localhost:8443/e/admin/">here</a>.

</body></html>

the question is, how can I configure the 301 jump correctly?

Mar.23,2021

you can try this on the line below server_name

server {
  listen 443;
  -sharp server_name *.ht920.com ht920.com;
  server_name www.ht920.com;
  server_name_in_redirect off;
  ssl on;
  ssl_certificate   cert/1523974750873.pem;
  ssl_certificate_key  cert/1523974750873.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  location / {
    index index.html index.htm index.php;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass https://localhost:8443;
  }
  access_log logs/ht920.com_access.log;
}

should use proxy_redirect

proxy_redirect https://www.ht920.com:8443/ /;
Menu