问题标签 [webapp-runner]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
109 浏览

tomcat - Heroku 部署上的 Camunda Rest API 基本身份验证 - Tomcat Webapp

我正在使用下面的 Github 存储库将 Camunda 部署到 Heroku,但它没有启用 Rest API。

https://github.com/plexiti/camunda-webapp-tomcat-standalone-heroku

根据我的研究,我认为这将通过编辑使用 Webapp-Runner 存储库的 pom.xml 文件来完成,该存储库讨论使用以下参数。

--enable-basic-auth --basic-auth-pw --basic-auth-user

文档在这里https://github.com/heroku/webapp-runner/blob/master/README.md

这是 pom.xml 文件

https://github.com/plexiti/camunda-webapp-tomcat-standalone-heroku/blob/master/pom.xml

所有这些都超出了我的经验水平,我将感谢社区的任何帮助。

提前致谢

0 投票
1 回答
165 浏览

angular - Spring Boot + Angular 应用程序作为 WAR 部署到 Heroku,抛出 404,除非我在 URL 中包含“index.html”

我正在尝试创建一个非常基本的 Spring Boot + Angular 应用程序,然后我将能够开发并自动部署为单个应用程序。为了构建应用程序,我将 Maven 配置为编译 Angular 项目并将其与我的后端一起添加到 WAR 文件中。然后它将 WAR 部署到 Heroku,Heroku 使用以下 web dyno 启动它:

我正在使用 Webapp Runner,它使用给定的 WAR 启动 Tomcat 实例。

Angular 部分本身是使用 package.json 中的安装后脚本构建的:

如您所见,我已在此处和 pom.xml 中将 base-href 设置为“/ui/”。我将我的 Spring Controller 映射到“/api”。我希望能够访问我的前端https://app.herokuapp.com/ui并发出后端请求,例如https://app.herokuapp.com/api/hello-world

虽然后端部分工作正常,但当我尝试访问 UI 时,我遇到了 404 Whitelabel 错误页面。我的 webapp 文件夹 (src/main/webapp) 如下所示:

web.xml 不包含任何配置。index.jsp 将重定向发送到“/ui/”。如果我将重定向更改为“/ui/index.html”,我可以使用 URL 访问我的前端https://app.herokuapp.com/,但是当我刷新页面时,我再次得到 404。

到目前为止我尝试过的事情:

  • 为“”(空)路径设置 Angular 路线 - 没有帮助,但我还是保留了它。

  • 添加server.servlet.context-path到 Spring 属性而不是使用 @RequestMapping 注释。

  • 在 Spring 的 application.properties 中禁用 Whitelabel 错误页面,这会导致出现关于未处理错误的不同错误。

  • 在 web.xml 中指定错误页面位置。它没有改变任何东西。

  • 在 Java 主类中覆盖 SpringBootServletInitializer 的配置方法。

  • 在 Angular ( RouterModule.forRoot(routes, { useHash: true }))中使用哈希定位策略

从我目前所阅读的内容来看,我最好的猜测是我的 Tomcat 配置不正确,但我不知道如何修复它。如果它使事情变得更容易,我愿意从前端 URL 中删除“/ui/”部分。

最后,我将包含一些我认为可能与该问题相关的文件。

索引.jsp

web.xml

主弹簧类

pom.xml