我正在使用Nginx作为Spring启动应用程序的反向代理.我还使用带有sockjs和stomp消息的Websockets.
这是上下文配置.
<websocket:message-broker application-destination-prefix="/app">
<websocket:stomp-endpoint path="/localization" >
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" />
</websocket:message-broker>
Run Code Online (Sandbox Code Playgroud)
这是客户端代码:
var socket = new SockJS(entryPointUrl);
var stompClient = Stomp.over(socket);
var _this = this;
stompClient.connect({}, function () {
stompClient.subscribe('/app/some-url', function (message) {
// do some stuff
});
});
Run Code Online (Sandbox Code Playgroud)
我也是Spring Security来保护一些内容.
@Configuration
@Order(4)
public static class FrontendSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/js/**", "/css/**", "/webjars/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login").permitAll()
.and()
.logout().permitAll();
}
}
Run Code Online (Sandbox Code Playgroud)
当我在Nginx反向代理后面运行这个应用程序时,一切都很好.这是相反的配置:
proxy_pass http://testsysten:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host; …Run Code Online (Sandbox Code Playgroud) Npm 允许使用自定义 git URL 来指定依赖项(请参阅package.json 中的 npm install private github repositories by dependency)。
但是,这些依赖项通常打包并发布到 npm 注册表,因此可以按名称安装它们。这个发布过程通常包括构建文件、缩小文件等,这些文件通常在 github 中不可用。
使用自定义 git URL 安装依赖项时,可能需要这些构建、缩小等文件,但它们将不可用。
要生成这些文件,可以使用npm 脚本在安装生命周期中运行一个钩子。但是,我找不到适合此任务的脚本,因为:
prepare和prepublishOnlynpm pack和之后运行(如文档中所述)。但是,在全局安装(节点 LTS 版本:v6.11.0,npm 版本(来自节点 LTS):3.10.10)中尝试此脚本时不会触发它。npm publish不要使用安装。使用 .gyp 文件进行编译,并为其他任何内容预发布。您几乎不必显式设置预安装或安装脚本。如果您正在这样做,请考虑是否还有其他选择。安装或预安装脚本的唯一有效用途是编译,必须在目标架构上完成。