我想在nginx入口kubernete中重定向域。
https://test.example.io/preview/qLxiVcDGxCaQ134650121853FTg4
如果URL preview
中有更改域重定向
https://test.app.example.io/preview/qLxiVcDGxCaQ134650121853FTg4
我在尝试什么
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
certmanager.k8s.io/cluster-issuer: staging
nginx.ingress.kubernetes.io/rewrite-target: /
kubernetes.io/ingress.class: nginx
name: staging-ingress
spec:
rules:
- host: test.example.io
http:
paths:
- path: /
backend:
serviceName: service-1
servicePort: 80
- path: /preview/*
backend:
url:
serviceName: service-2
servicePort: 80
tls:
- hosts:
- test.example.io
secretName: staging
简单的nginx块就像
location ~ /preview
{
rewrite /preview https://test.app.example.com$uri permanent;
}
答案 0 :(得分:3)
我的逻辑思维,尝试一下:
metadata:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite /preview https://test.app.example.com$uri permanent;
spec:
rules:
- host: test.example.io
http:
paths:
- path: /
backend:
serviceName: service-1
servicePort: 80
- host: test.app.example.io
http:
paths:
- path: /preview/*
backend:
serviceName: service-2
servicePort: 80
希望它有效!
在上面的代码中:您根本不应使用:https://test.app.example.io/preview/(只是被重定向的link)访问。
答案 1 :(得分:1)
尝试一下-
~~~~~~~~~ at org.hibernate.hql.internal.ast.ErrorTracker.throwQueryException(ErrorTracker.java:93)
~~~~~~~~~ at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:277)
~~~~~~~~~ at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:191)
~~~~~~~~~ at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143)
~~~~~~~~~ at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:119)
~~~~~~~~~ at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
~~~~~~~~~ at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
~~~~~~~~~ at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:595)
~~~~~~~~~ at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:704)
~~~~~~~~~ ... 100 common frames omitted
您也可以参考this,代表问题的同义词
答案 2 :(得分:0)
使用过的nginx入口注释
library(dplyr)
my_format <- function(x) {
case_when(
between(x, 0, 1) ~ ceiling(x / .1 ) * .1,
between(x, 1, 10) ~ ceiling(x / .5 ) * .5,
between(x, 11, 20) ~ ceiling(x / 1 ) * 1,
between(x, 21, 100) ~ ceiling(x / 5 ) * 5,
between(x, 101, 200) ~ ceiling(x / 10 ) * 10,
between(x, 201, 1000) ~ ceiling(x / 50 ) * 50,
between(x, 1001, 2000) ~ ceiling(x / 100) * 100,
between(x, 2001, 10000) ~ ceiling(x / 500) * 500
)
}
my_format(0.44)
#> [1] 0.5
my_format(4.1)
#> [1] 4.5
my_format(4.51)
#> [1] 5
my_format(11.1)
#> [1] 12
my_format(22.5)
#> [1] 25
my_format(121.1)
#> [1] 130
my_format(201.1)
#> [1] 250
my_format(1002.3)
#> [1] 1100
my_format(2001.1)
#> [1] 2500