小编BHa*_*man的帖子

Kubernetes在AWS上使用ELB终止SSL的HTTP到HTTPS重定向

我正在尝试为到Kubernetes集群的流量设置一个简单的HTTP到HTTPS重定向。SSL终止发生在ELB上。当我尝试使用时,nginx.ingress.kubernetes.io/ssl-redirect = true它会导致无限重定向,这导致我设置了配置映射来处理此问题(nginx-ingress:启用force-ssl时重定向过多)。

现在看来根本没有重定向发生。

我的入口服务定义为:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "3600"
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:...:certificate/...
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: https
  labels:
    k8s-addon: ingress-nginx.addons.k8s.io
  name: ingress-nginx
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Cluster
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: http
  - name: http
    port: 80
    protocol: TCP
    targetPort: http
  selector:
    app: ingress-nginx
  type: LoadBalancer
Run Code Online (Sandbox Code Playgroud)

我的配置映射定义为:

apiVersion: v1
kind: ConfigMap
data:
  client-body-buffer-size: 32M
  hsts: "true"
  proxy-body-size: 1G
  proxy-buffering: "off"
  proxy-read-timeout: "600"
  proxy-send-timeout: "600"
  server-tokens: "false"
  ssl-redirect: …
Run Code Online (Sandbox Code Playgroud)

ssl amazon-web-services amazon-elb kubernetes nginx-ingress

5
推荐指数
1
解决办法
2788
查看次数

Spring Data JPA 在 Spring Boot 应用程序中不使用 AttributeConverter

我有一个 spring boot 应用程序,它AttributeConverter为一个实体指定一个,该实体将枚举从大写转换为标题大小写以存储在数据库中。

我有以下实体:

@Entity
@Table(name = "customerleads")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CustomerLead implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Enumerated(EnumType.STRING)
    @Column(name = "type")
    @Convert(converter = CustomerLeadTypeConverter.class)
    private CustomerLeadType type = CustomerLeadType.OPEN;
}
Run Code Online (Sandbox Code Playgroud)

以及以下 AttributeConverter 类:

@Converter(autoApply = true)
public class CustomerLeadTypeConverter implements AttributeConverter<CustomerLeadType, String> {

    @Override
    public String convertToDatabaseColumn(CustomerLeadType attribute) {
        switch (attribute) {
            case OPEN:
                return "Open";
            case CLOSED:
                return "Closed";
            case DELETED:
                return "Deleted";
            default:
                throw new IllegalArgumentException("Unknown" + attribute); …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate spring-data-jpa spring-boot

3
推荐指数
1
解决办法
4961
查看次数