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

request help: why the location in response header that returned by APISIX has the 9443 port? #6954

Closed
shuoshadow opened this issue Jun 2, 2021 · 21 comments
Labels
no response wait for update wait for the author's response in this issue/PR

Comments

@shuoshadow
Copy link

shuoshadow commented Jun 2, 2021

Issue description

apisix前使用slb 443端口转发到apisix的9443端口
apisix 代理https请求后 携带了9443端口导致无法重定向
image

是因为header的原因吗?我配置了apisixroute的proxy-rewrite插件也不行

    - name: proxy-rewrite
      enable: true
      config:
        headers:
          "Host": $host

Environment

  • your apisix-ingress-controller version (output of apisix-ingress-controller version --long);
  • your Kubernetes cluster version (output of kubectl version);
  • if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (uname -a).
@tokers
Copy link
Contributor

tokers commented Jun 2, 2021

@shuoshadow Which action results in this redirect? Is this a behavior of APISIX itself or its backend?

@tao12345666333 tao12345666333 added the wait for update wait for the author's response in this issue/PR label Mar 23, 2022
@tao12345666333
Copy link
Member

Can you provide more detailed information?

@wangyp0701
Copy link

wangyp0701 commented Apr 25, 2022

I have encountered a similar situation
kubernetes svc Access normal
6NQERMQMV@{WH G}V(CW(CD

apisixroute

6NQERMQMV@{WH G}V(CW(CD

@tokers
Copy link
Contributor

tokers commented Apr 25, 2022

This is an already known problem, see #6686.

@wangyp0701
Copy link

#6286 (comment)
This is not the best way

@Horus-K
Copy link

Horus-K commented Apr 27, 2022

#6945 proxy-rewrite cannot modify X-Forwarded-Port same problem as mine

@tao12345666333 tao12345666333 transferred this issue from apache/apisix-ingress-controller Apr 28, 2022
@Horus-K
Copy link

Horus-K commented Apr 28, 2022

@shuoshadow Temporary workaround: Change the apisix port to 80 443

@tokers
Copy link
Contributor

tokers commented Apr 28, 2022

Or should apache apisix handle the port in redirect url by using the X-Forwarded-Port?

@tzssangglass tzssangglass changed the title request help: 为什么apisix response header 中的location会携带9443端口 request help: why the location returned by apisix response header has the 9443 port? Apr 28, 2022
@tzssangglass tzssangglass changed the title request help: why the location returned by apisix response header has the 9443 port? request help: why the location in response header that returned by APISIX has the 9443 port? Apr 28, 2022
@tzssangglass
Copy link
Member

Or should apache apisix handle the port in redirect url by using the X-Forwarded-Port?

+1.

ref: #6945

@snksos
Copy link

snksos commented Jul 4, 2022

https://apisix.apache.org/docs/apisix/plugins/redirect#example-usage

set apisix config.yaml

...
ssl:
enable: true
enable_http2: true
listen_port: 443
...

will redirect 443 port

@vvavepacket
Copy link

Was this fixed on recent releases? Whats the recommended way going forward for this issue?

@tokers
Copy link
Contributor

tokers commented Jan 27, 2023

Was this fixed on recent releases? Whats the recommended way going forward for this issue?

What's your version? Recent releases will check the X-Forwarded-Port header, so the redirect will be correct.

@fbossiere
Copy link

I am using the last available version of the apisix helm chart with default option.
When i try to access the keycloak admin console, APISIX redirects me as follows:
https://keycloak.mydomain.com:9443/admin/

Can you please give us the way to fix this please ?

@tokers
Copy link
Contributor

tokers commented Feb 6, 2023

@fbossiere Without a context, I didn't know if this is an issue or a normal scene.

@fbossiere
Copy link

fbossiere commented Feb 6, 2023 via email

@tokers
Copy link
Contributor

tokers commented Feb 6, 2023

a quick fix for this is setting the HTTPS port to 443 via the field: https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L192.

@tokers
Copy link
Contributor

tokers commented Feb 6, 2023

@fbossiere If this is OK for you, would you like to submit a PR to mention it in the docs?

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions
Copy link

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2023
@lkad
Copy link

lkad commented Oct 22, 2024

"Has anyone fixed this issue? I am experiencing the same problem."

@lkad
Copy link

lkad commented Oct 22, 2024

a quick fix for this is setting the HTTPS port to 443 via the field: https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L192.

This configuration has the load balancer port set to 443, but if the port inside the container is 9443, it will still redirect to 9443.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no response wait for update wait for the author's response in this issue/PR
Projects
None yet
Development

No branches or pull requests

10 participants