You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "wfy-belief (via GitHub)" <gi...@apache.org> on 2024/06/17 12:55:29 UTC
[I] help request: 尝试代理 hdfs 的 webui,但是会返回 302 重定向,应该如何配置呢?或者是否有示例 [apisix]
wfy-belief opened a new issue, #11358:
URL: https://github.com/apache/apisix/issues/11358
### Description
```yaml
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: hadoop-route
spec:
http:
- name: namenode
match:
hosts:
- example.com
paths:
- /hdfs/*
backends:
- serviceName: namenode-service
servicePort: 9870
plugins:
- name: proxy-rewrite
enable: true
config:
regex_uri: [ "^/hdfs/(.*)", "/$2" ]
# - name: response-rewrite
# enable: true
# config:
# status_code: 302
# # "body": "{\"code\":\"ok\",\"message\":\"new json body\"}"
# headers:
# set:
# X-Server-id: 3
# X-Server-status: 'on'
# X-Server-balancer-addr: '$balancer_ip:$balancer_port'
# Location: example.com/hdfs/
# vars:
# - "[ \"status\",\"==\",403 ]"
```
然后我请求这个路径的 curl 如下
```
curl acitrus.cn/hdfs/ -vl
* Host example.com:80 was resolved.
* IPv6: (none)
* IPv4: xxxxx
* Trying xxxx:80...
* Connected to example.com (xxxx) port 80
> GET /hdfs/ HTTP/1.1
> Host: example.com
> User-Agent: curl/8.6.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Content-Type: text/plain;charset=utf-8
< Content-Length: 0
< Connection: keep-alive
< Date: Mon, 17 Jun 2024 12:53:07 GMT
< Cache-Control: no-cache
< Expires: Mon, 17 Jun 2024 12:53:07 GMT
< Pragma: no-cache
< X-Content-Type-Options: nosniff
< X-FRAME-OPTIONS: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Location: http:// example.com/index.html
< Server: APISIX/3.9.1
<
* Connection #0 to host acitrus.cn left intact
```
这个是否只能开发自定义插件解决了呢 QAQ
### Environment
- APISIX version (run `apisix version`):
- 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`):
--
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
Re: [I] help request: 尝试代理 hdfs 的 webui,但是会返回 302 重定向,应该如何配置呢?或者是否有示例 [apisix]
Posted by "dyrnq (via GitHub)" <gi...@apache.org>.
dyrnq commented on issue #11358:
URL: https://github.com/apache/apisix/issues/11358#issuecomment-2209671179
@wfy-belief 你可以使用 ApisixUpstream 的 healthCheck.active 主动健康检测9870端口的 /isActive 路径,这个在haproxy中很好实现 可以参考<https://dyrnq.com/hadoop-namenode-ha/#%e8%a7%a3%e5%86%b3>
--
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
Re: [I] help request: 尝试代理 hdfs 的 webui,但是会返回 302 重定向,应该如何配置呢?或者是否有示例 [apisix]
Posted by "wfy-belief (via GitHub)" <gi...@apache.org>.
wfy-belief closed issue #11358: help request: 尝试代理 hdfs 的 webui,但是会返回 302 重定向,应该如何配置呢?或者是否有示例
URL: https://github.com/apache/apisix/issues/11358
--
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
Re: [I] help request: 尝试代理 hdfs 的 webui,但是会返回 302 重定向,应该如何配置呢?或者是否有示例 [apisix]
Posted by "hanqingwu (via GitHub)" <gi...@apache.org>.
hanqingwu commented on issue #11358:
URL: https://github.com/apache/apisix/issues/11358#issuecomment-2182128966
个人感觉,可能的两种方法:
1 用apisix 来处理这个302, 添加一条route, 直接把 / 代理到 /index.html
2. 用response_write, 把302的返回,添加你的 “hdfs” 这段代理头
--
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