首页 » Latest Post

chrome的hsts政策,针对.app域名,chrome强制使用https协议访问,比如:

http://hitube.app 会转换成
https://hitube.app

可以打开 chrome://net-internals/#hsts 查询 Query HSTS/PKP domain


static_sts_domain: app
static_upgrade_mode: FORCE_HTTPS
static_sts_include_subdomains: true
static_sts_observed: 1540270800
static_pkp_domain: 
static_pkp_include_subdomains: 
static_pkp_observed: 
static_spki_hashes: 
dynamic_sts_domain: hitube.app
dynamic_upgrade_mode: FORCE_HTTPS
dynamic_sts_include_subdomains: false
dynamic_sts_observed: 1542096503.341038
dynamic_sts_expiry: 1628496503.341037
dynamic_pkp_domain: 
dynamic_pkp_include_subdomains: 
dynamic_pkp_observed: 
dynamic_pkp_expiry: 
dynamic_spki_hashes: 

对于一般的域名,可以使用Delete domain security policies 删掉,但是.app 域名不可以,只能安装证书了

昨天把spring boot升级到2.1.0版本,但是报错如下


***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'dataSource', defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

查了下,原来和spring cloud版本不兼容,更改如下:


<spring-cloud.version>Finchley.SR1</spring-cloud.version>
改成
<spring-cloud.version>Greenwich.M1</spring-cloud.version>

但是spring boot 2.1 和Greenwich.M1搭配仍然有部分问题,有人建议用2.1的snapshot版本,考虑稳定性问题,我有回退到2.0.6 + Finchley.SR1 了,可以看出spring boot是用版本的第二个数字保证兼容性的。

spring cloud gateway中有gateway filter 和global filter,前者是针对路由规则配置到某个路由规则上,后者是全局的。定义一个全局filter的方法如下

@Component
public class GlobalFilterConfig {
    @Bean
    @Order(-1)
    public GlobalFilter a() {
        return (exchange, chain) -> {
            System.out.print("first pre filter");
            return chain.filter(exchange).then(Mono.fromRunnable(() -> {
                System.out.print("third post filter");
            }));
        };
    }
}

最近碰到Eureka一个问题,就是多台Eureka部署集群时,会都出现在unavailable-replicas 下面。


unavailable-replicas    http://node2.thor.eureka:3333/eureka/,http://node1.thor.eureka:3333/eureka/

发现原因时这个,发布时要指定hostName

myHostName: node1.thor.eureka
eureka:
  instance:
    hostname: ${myHostName}

然后发布时指定


java -jar eureka.jar --myHostName=node2.thor.eureka

注意,下面两个选项要打开

eureka:
  client:
    register-with-eureka: true
    fetch-registry: true