You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/05/16 03:05:32 UTC

[GitHub] [servicecomb-samples] Young4Dream opened a new issue #53: 静态资源访问不了

Young4Dream opened a new issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53


   我按照porter_lightweight和springboot中readme的操作启动服务,webroot也设置了,并且把ui文件夹放在了${gateway.webroot}下,但访问/ui/login.html出错:Request has already been read


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] liubao68 commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-629932151


   是在 windows 还是 linux下面运行? 
   
   ```
   gateway:
     webroot: /code/servicecomb-samples/porter_lightweight/gateway-service/src/main/resources
   ```
   
   windows下面注意盘符, 以 / 开头。 
   
   linux 下面要使用相对路径。 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] xuleixie edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
xuleixie edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-719152209


   出现无法访问的问题原因为:
   microservice.yml中的webroot路径没有配置正确,在配置文件的最下面一行,必须要以/开头,例如:
   /github-projects/servicecomb-fence/samples/EdgeService/src/main/resources,这个路径是正确的,可以访问,我的应用名称是servicecomb-fence,放置的路径为:D:\github-projects


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] huaian edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
huaian edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-657147327


   windows上、linux也遇到这个问题,能否更新一下demo,使用相对目录,避免设置兼容性问题


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] liubao68 closed issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
liubao68 closed issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] Young4Dream edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
Young4Dream edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-633232722


   不是环境的问题,是spring-boot-maven-plugin的打包方式与普通jar包不一样,如果按照您README里所述,使用java -jar 启动,是无法访问到静态资源的.
   目前唯一能想到的就是使用maven插件把ui文件夹拷贝到当前系统的指定位置,再为gateway.webroot赋上相应的值,但这显然不是最好的办法.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] Young4Dream commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
Young4Dream commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-633232722


   不是环境的问题,是spring-boot-maven-plugin的打包方式与普通jar包不一样,如果按照您README里所述,使用java -jar 启动,是无法访问到静态资源的.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] xuleixie edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
xuleixie edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-719152209


   出现无法访问的问题原因为:
   microservice.yml中的webroot路径没有配置正确,在配置文件的最下面一行,必须要以/开头,例如:
   gateway.webroot: /github-projects/servicecomb-fence/samples/EdgeService/src/main/resources,这个路径是正确的,可以访问,我的应用名称是servicecomb-fence,放置的路径为:D:\github-projects


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] huaian commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
huaian commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-657147327


   windows上也遇到这个问题,能否更新一下demo,使用相对目录,避免设置兼容性问题


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] huaian edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
huaian edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-657147327


   windows上、linux也遇到这个问题,能否更新一下demo,使用相对目录,避免设置兼容性问题
   
   Linux环境下测试通过,使用相对路径: 
   
     webroot: ./bmi/webapp/src/main/resources/static


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] onemoreflag commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
onemoreflag commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-1073422938


   建议把静态资源配置项写入README,否则试用的时候访问不了并且很难定位到原因
   # This is web root for windows server, change this path according to where you put your source code
   gateway:
   #  webroot: /code/servicecomb-samples/porter_lightweight/gateway-service/src/main/resources
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] Young4Dream edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
Young4Dream edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-633232722


   不是环境的问题,是spring-boot-maven-plugin的打包方式造成的目录结构与普通jar包不一样,如果按照您README里所述,使用java -jar 启动,是无法访问到静态资源的.而正常情况下,静态资源都是放在jar包中,您给出的使用绝对路径的方式访问,显然不是最好的解决方案.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] Shenpotato commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
Shenpotato commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-898276232


   如果在linux上部署的话,修改application.yaml为中的webroot为相对路径:src/main/resources/static


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] liubao68 commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-633350422


   spring boot打包确实有问题的。需要独立准备一个目录。 samples的实现采用了 vert.x , 以前实现的不支持 jar 读取静态页面, 这块需要自行查询下是否可以通过代码实现。 或者采用其他方式托管静态页面,比如通过一个独立的微服务, edge 将请求转发到这个微服务即可 。 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] xuleixie commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
xuleixie commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-719152209


   > windows上、linux也遇到这个问题,能否更新一下demo,使用相对目录,避免设置兼容性问题
   > 
   > Linux环境下测试通过,使用相对路径:
   > 
   > webroot: ./bmi/webapp/src/main/resources/static
   microservice.yml中的webroot路径没有配置正确,在配置文件的最下面一行,必须要以/开头,例如:
   /github-projects/servicecomb-fence/samples/EdgeService/src/main/resources,这个路径是正确的,可以访问,我的应用名称是servicecomb-fence,放置的路径为:D:\github-projects


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] liubao68 commented on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-657194723


   例子采用的是在 edge-service 提供静态页面服务, 使用了 vert.x 提供的 http server, 这个服务器指定路径需要配置项,不支持将静态资源打包到 jar 包中, 有些不方便,并且 windows, linux配置不一样。
   
   为了简单, 我修改了下 porter-spring-boot, 静态页面采用 spring boot tomcat 托管, 网关通过 CommonHttpEdgeDispatcher 转发请求, 这样静态页面可以作为一个独立到微服务打包为jar包运行, 就可以减少错误。 参考: https://github.com/apache/servicecomb-samples/pull/55  
   
   porter-spring-boot最新代码已经合入。 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-samples] liubao68 edited a comment on issue #53: 静态资源访问不了

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #53:
URL: https://github.com/apache/servicecomb-samples/issues/53#issuecomment-629932151


   是在 windows 还是 linux下面运行? 
   
   ```
   gateway:
     webroot: /code/servicecomb-samples/porter_lightweight/gateway-service/src/main/resources
   ```
   
   windows下面注意盘符, 以 / 开头。 
   
   linux 下面要使用相对路径。 
   
   
   如果仍然不确定原因,可以看看: StaticWebpageDispatcher , 尝试调试下。 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org