Is this a request for help?: yes
What keywords did you search in NGINX Ingress controller issues before filing this one?: proxy
FEATURE REQUEST :
NGINX Ingress controller version: V0.22.0
Kubernetes version (use kubectl version): v1.11.5
What happened: I want to add some reverse proxy in ingress, but I don't know how to deal with it. If use nginx, configuration like this:
location / {
proxy_pass http://xxx-prod-static.oss-internal.aliyuncs.com/xxx/resources/dist/index.html;
}
location /resources/dist {
rewrite ^/(.*)$ /bops/$1 break;
proxy_pass http://xxx-prod-static.oss.aliyuncs.com;
}
location /bim-resource/ueditor {
proxy_pass http://xxx-prod-static.oss-internal.aliyuncs.com/bim-resource/ueditor;
}
and everything is ok. I tried to use and, but nothing worked. Thank you!
You can use service of type ExternalName to achieve this: https://www.elvinefendi.com/2018/08/08/ingress-nginx-proxypass-to-external-upstream.html
Closing. The previous comment is the right way to do this.
@ElvinEfendi @aledbf Thank yo, I have tried that method, but it seems does not worked, it should caused by my cluster's version.
It does not work for me too. It's related with cluster's version?
I couldn't find any information about it..
@joe-re as previous comment, I have solve the problem,2 points you should try:
ExternalName service;my cofigure as follows,:
kind: Service
apiVersion: v1
metadata:
name: hhu-static
spec:
type: ExternalName
# this is domian of oss, it will return CNAME to mapping this
externalName: hhu-prod-static.oss-cn-beijing-internal.aliyuncs.com
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: server-hhu
annotations:
kubernetes.io/ingress.class: nginx-ingress
spec:
rules:
- host: k8s-www.hhu.com
http:
paths:
- path: /*
backend:
serviceName: hhu-static
servicePort: 80
note: you must bind domain k8s-www.hhu.com to your oss bucket. I hope this can help you.
@Jacksonary Thank you for your response.
Unfortunately it still does't work.
ingress-nginx controller always return 502.
Maybe I have to set dns name server to resolve my external service CNAME..?
Anyway I find one solution for that, server-snippet setting allows to add additional location header to nginx.conf.
I'm gonna try that. Thanks.
you should define port for service with ExternaName type like:
```kind: Service
apiVersion: v1
metadata:
name: hhu-static
spec:
type: ExternalName
externalName: hhu-prod-static.oss-cn-beijing-internal.aliyuncs.com
ports:
you should define port for service with ExternaName type like:
apiVersion: v1 metadata: name: hhu-static spec: type: ExternalName externalName: hhu-prod-static.oss-cn-beijing-internal.aliyuncs.com ports: - port: 443
Hi I am facing error
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
@ak895912 it's up to the protocol of your oss's provider
Most helpful comment
@joe-re as previous comment, I have solve the problem,2 points you should try:
ExternalNameservice;my cofigure as follows,:
note: you must bind domain
k8s-www.hhu.comto your oss bucket. I hope this can help you.