You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/25 08:36:47 UTC

[GitHub] [apisix] Drewolf opened a new issue, #8405: help request: http 强制跳转至https

Drewolf opened a new issue, #8405:
URL: https://github.com/apache/apisix/issues/8405

   ### Description
   
   你好,我通过apisix-dashboard配置重定向,想实现 http 强制 跳转 https。发现跳转过后的https地址和我实际浏览器请求的地址不一致,如何配置才能不改变我的请求地址。
   ![image](https://user-images.githubusercontent.com/30138193/203936516-acd8589e-024c-477d-b8c6-9064726c59ee.png)
   
   ![image](https://user-images.githubusercontent.com/30138193/203936721-77e6183a-52b4-4102-aae7-6268b0d0498f.png)
   
   我请求的地址是 http://nginx.qa.xgimi.com/neo/voice/1.html 
   强制跳转过后的地址是 https://nginx.qa.xgimi.com:9443/neo/voice/1.html
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.15.0-alpine
   - Operating system (run `uname -a`): helm 部署
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): 3.5.4-debian-11-r14
   - APISIX Dashboard version, if relevant: 2.13-alpine
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328401501

   > phase
   
   官网这部分写的比较简略,能否发一下具体的配置示例?谢谢


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328220375

   I think the redirect plugin cannot handle this scenario right now, there is a hack way for this: adding the serverless plugin, handling the Location header in the header_filter phase by yourself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327981445

   > 
   
    我猜测也是这个原因,9443是APISIX的https端口。但是我应该怎么配置,才能达到我的预期呢?
   http://nginx.qa.xgimi.com/neo/voice/1.html 强制跳转到 https://nginx.qa.xgimi.com/neo/voice/1.html, 而不是https://nginx.qa.xgimi.com:9443/neo/voice/1.html
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328931523

   @Drewolf The `plugin_attrs` should be configured on the APISIX side. See https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L494.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #8405: help request: http 强制跳转至https

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327252399

   @Drewolf Your Layer-4 proxy should take the `X-Forwarded-Port`, or APISIX will use the server port that accepts the request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tokers commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328408474

   @Drewolf Sorry, APISIX already support configuring a port for this case:
   
   > When enabling http_to_https, the ports in the redirect URL will pick a value in the following order (in descending order of priority)
   Read plugin_attr.redirect.https_port from the configuration file (conf/config.yaml).
   If apisix.ssl is enabled, read apisix.ssl.listen and select a port randomly from it.
   Use 443 as the default https port.
   
   See https://apisix.apache.org/docs/apisix/plugins/redirect/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: http 强制跳转至https

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327208284

   > @Drewolf https://nginx.qa.xgimi.com:9443/neo/voice/1.html is your target address?
   
   这不是我的目标地址,9443是apisix gateway的https端口。客户端请求的地址是 http://nginx.qa.xgimi.com/neo/voice/1.html,然后到达 apisix gateway 的4层负载均衡(LB)的443端口,LB 443 端口对应apisix gateway 的 9443(https)端口


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: http 强制跳转至https

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327281811

   > @Drewolf Your Layer-4 proxy should take the `X-Forwarded-Port`, or APISIX will use the server port that accepts the request.
   
   X-Forwarded-Port 不是7层负载均衡(LB)才能配置的吗?我用的华为云,在负载均衡上没找到配置这个的地方


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] juzhiyuan commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327944830

   > 我请求的地址是 http://nginx.qa.xgimi.com/neo/voice/1.html
   > 强制跳转过后的地址是 https://nginx.qa.xgimi.com:9443/neo/voice/1.html
   
   Hi @Drewolf, to confirm: your question is, "why the URL ends with `9443`"? 
   
   9443 is used by APISIX as the default HTTPS Listening Port, maybe that's the reason?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328165875

   > 
   
   请问应该如何配置,才能达到我的预期效果呢?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1330464133

   > @Drewolf The `plugin_attrs` should be configured on the APISIX side. See https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L494.
   
   谢谢,我通过修改chart中的ssl端口解决了我的问题。
   ![企业微信截图_16696096219465](https://user-images.githubusercontent.com/30138193/204514259-1821317b-90ce-4e92-8f5c-a7630f8b2edf.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Hazel6869 commented on issue #8405: help request: http 强制跳转至https

Posted by GitBox <gi...@apache.org>.
Hazel6869 commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1327168467

   @Drewolf https://nginx.qa.xgimi.com:9443/neo/voice/1.html is your target address?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328165977

   > > 我请求的地址是 http://nginx.qa.xgimi.com/neo/voice/1.html
   > > 强制跳转过后的地址是 https://nginx.qa.xgimi.com:9443/neo/voice/1.html
   > 
   > Hi @Drewolf, to confirm: your question is, "why the URL ends with `9443`"?
   > 
   > 9443 is used by APISIX as the default HTTPS Listening Port, maybe that's the reason?
   
   请问应该如何配置i,才能达到我的预期效果呢?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf commented on issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf commented on issue #8405:
URL: https://github.com/apache/apisix/issues/8405#issuecomment-1328415736

   > @Drewolf Sorry, APISIX already support configuring a port for this case:
   > 
   > > When enabling http_to_https, the ports in the redirect URL will pick a value in the following order (in descending order of priority)
   > > Read plugin_attr.redirect.https_port from the configuration file (conf/config.yaml).
   > > If apisix.ssl is enabled, read apisix.ssl.listen and select a port randomly from it.
   > > Use 443 as the default https port.
   > 
   > See https://apisix.apache.org/docs/apisix/plugins/redirect/
   
   我大概明白您的意思了,但是我在 apisix-dashboard 上没找到配置 https_port 的地方,请问在哪里配置呢?
   ![image](https://user-images.githubusercontent.com/30138193/204173856-5d16526e-adf8-4997-a636-af6acec2d3b4.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] Drewolf closed issue #8405: help request: how to redirect HTTP to HTTPs?

Posted by GitBox <gi...@apache.org>.
Drewolf closed issue #8405: help request: how to redirect HTTP to HTTPs?
URL: https://github.com/apache/apisix/issues/8405


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org