我面临的问题是:每次请求都会创建新的 sessionID。有人可以阐明这一点吗?
我正在使用的版本:
节点版本:v6.10.3 NPM 版本:3.10.10express@4.15.3express-session@1.15.3
另外,如果我没有专门设置 cookie,那么 maxAge 的默认值是多少?不确定是否需要。
您发现下面的代码有什么问题吗?请协助,因为我被困住了。
var app = express();
app.use(express.static(path.join(__dirname, 'landing')));
app.use(bodyparser.json());
app.set('trust proxy', 1) // trust first proxy
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
cookie: {secure: true}
}))
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname, 'landing', 'index.html'));
});
var contextPath = '/myportal';
//UI url
app.get(contextPath, function (req, res) {
var reqValues;
logger.info("req sessionID is :::" + req.sessionID);
// do something
}
app.use(express.static(path.join(__dirname, 'build'))); //react UI path
res.sendFile(path.join(__dirname, 'build', 'index.html'));
}
//health check …Run Code Online (Sandbox Code Playgroud) 我试图在pods上的docker容器中启用TLS启动GRPC服务器,但在服务器启动时收到以下错误
我正在尝试引用https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls
Java:jdk1.8.0_131 OpenSSL版本:OpenSSL 1.0.1e-fips
例外:
*Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.
at io.grpc.netty.GrpcSslContexts.selectApplicationProtocolConfig(GrpcSslContexts.java:174)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:151)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:139)
at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:119)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:377)
at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:63)*
Run Code Online (Sandbox Code Playgroud)
还想知道如何在本地测试openssl方法?
这就是我试图运行jar的方式:java -jar -Denv = e1 app.jar
以下是GRPC特有的与GRPC相关的POM依赖关系-I在我的POM中: - 扩展 -
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.0.Final</version>
</extension>
</extensions>
Run Code Online (Sandbox Code Playgroud)
- - 插入 - -
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.2.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.3.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
---依赖---
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId> …Run Code Online (Sandbox Code Playgroud)