perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.64k stars 1.56k forks source link

Proguard issue #956

Closed neilyoung closed 5 years ago

neilyoung commented 6 years ago

Hi, I have a spark based REST API, which hosts a couple of static pages in ./public. The folder has been made known to spark

staticFileLocation("/public");

The public folder is element of the JAR. As long as the JAR is not obfuscated by proguard, everything is fine. After obfuscation everything is still working (e.g. REST API), but the static pages are no longer served. Jetty returns 404.

The static app is a react-static app (https://github.com/nozzle/react-static), which is unable to cope with calls like localhost:port/index.html. This is for sure not related to spark or jetty and an issue has been opened already, but this is state of the art there. One is only allowed to call localhost:port in order to enter the pages. This works with NPM's development server as well as any other node based server.

However, Jetty seems to redirect/rewrite every "empty" URL to "index.html", which leads to 404...

The question now is: Why does this happen with the obfuscated JAR only?