-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Content with quarkus.http-root-context #19492
Comments
There is something fishy. For the record, the OP is talking about AFAICS, things are working in dev mode, I can get the index page by going to http://localhost:8080/testing/ but it's not working in prod mode when running the jar, RESTEasy takes the precedence somehow and is trying (and fails) to serve the resource. @stuartwdouglas does it ring a bell? |
Yes in dev mode it is picking up the one in Meta_inf/resources which is
similar but without the !!! in the test ( sorry should have made it more
obvious), as the index.html from UI has not been built into the project. I
normally run devServer in VueJS directly from ui directory and reverse
proxy to the main server during testing. Then build the VueJS and use the
plugin to pull it into the production build.
Kind Regards
---
Brent Crammond
*MBA, BSc(Comp. Sci.)*
email: ***@***.*** ***@***.***>
*mobile:* +64 21 228 5366
*“Live as if you were to die tomorrow. Learn as if you were to live
forever”* - *Gandhi*
…On Thu, Aug 19, 2021 at 9:16 PM Guillaume Smet ***@***.***> wrote:
There is something fishy. For the record, the OP is talking about
quarkus.http.root-path.
AFAICS, things are working in dev mode, I can get the index page by going
to http://localhost:8080/testing/ but it's not working in prod mode when
running the jar, RESTEasy takes the precedence somehow and is trying (and
fails) to serve the resource.
@stuartwdouglas <https://github.com/stuartwdouglas> does it ring a bell?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19492 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYWIXOQV5FP2B53IDFB4LT5TDWFANCNFSM5CNSFWFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Also if you build it without the quarkus.http.root-path it works fine, in
production.
Kind Regards
---
Brent Crammond
*MBA, BSc(Comp. Sci.)*
email: ***@***.*** ***@***.***>
*mobile:* +64 21 228 5366
*“Live as if you were to die tomorrow. Learn as if you were to live
forever”* - *Gandhi*
…On Thu, Aug 19, 2021 at 9:16 PM Guillaume Smet ***@***.***> wrote:
There is something fishy. For the record, the OP is talking about
quarkus.http.root-path.
AFAICS, things are working in dev mode, I can get the index page by going
to http://localhost:8080/testing/ but it's not working in prod mode when
running the jar, RESTEasy takes the precedence somehow and is trying (and
fails) to serve the resource.
@stuartwdouglas <https://github.com/stuartwdouglas> does it ring a bell?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19492 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYWIXOQV5FP2B53IDFB4LT5TDWFANCNFSM5CNSFWFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Well, in any case, even if not serving the exact same file, serving the static file is working in dev mode but not in prod mode. |
One possibility is does the normal build create the static content into
code, it didn't look like it. I have followed this pattern quite a few
times but this is the first time I have tried to change the
quarkus.http.root-path.
Kind Regards
---
Brent Crammond
*MBA, BSc(Comp. Sci.)*
email: ***@***.*** ***@***.***>
*mobile:* +64 21 228 5366
*“Live as if you were to die tomorrow. Learn as if you were to live
forever”* - *Gandhi*
…On Thu, Aug 19, 2021 at 9:26 PM Guillaume Smet ***@***.***> wrote:
Well, in any case, even if not serving the exact same file, serving the
static file is working in dev mode but not in prod mode.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19492 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYWIXWYZMZ5FM4HDOAKATT5TE3FANCNFSM5CNSFWFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
It works if you remove the final slash of your root path:
I'll have a closer look at what is happening... |
I think it's better to make sure it's always consistent. '/' is a bit of a special case right now and not entirely consistent with the no slash at the end rule but I think we can live with it. Fixes quarkusio#19492
#19501 will hopefully fix it. |
I just noticed that it is throwing an error when I take the / off the end of the configuration was changed too quarkus.http.root-path=/testing 2021-08-19 22:05:45,432 ERROR [io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-9) Unhandled exception in router: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 |
Weird I don't have that with the |
Make sure the quarkus.http.root-path always starts and ends with a '/' so that we don't have any risk of having logic working with '/test' and not with '/test/'. Fixes quarkusio#19492
Ok, I don't know why it's working with |
…config level Make sure both paths always start and end with a '/' so that we don't have any risk of having logic working with '/test' and not with '/test/'. Also simplify a few things thanks to that. Fixes quarkusio#19492
…config level Make sure both paths always start and end with a '/' so that we don't have any risk of having logic working with '/test' and not with '/test/'. Adjust the servlet context path too. Also simplify a few things thanks to that. Fixes quarkusio#19492
…config level Make sure both paths always start and end with a '/' so that we don't have any risk of having logic working with '/test' and not with '/test/'. Adjust the servlet context path too. Also simplify a few things thanks to that. Fixes quarkusio#19492
Describe the bug
If I set the quarkus.http-root-context static content does not always work.
I have a Vue front end that is included from the src/main/ui directory.
When I run it from the command line
java -jar target/quarkus-app/quarkus-run.jar
The jax-rs call works but the static content does not.
Expected behavior
quarkus.http-root-context = /testing/
Working:
http://127.0.0.1:8080/testing/hello
Not working:
http://127.0.0.1:8080/testing/
http://127.0.0.1:8080/testing/index.html
These should show the web page from the UI directory, note if I don't have the quarkus.http-root-context set it works correctly.
Actual behavior
It should be displaying the index.html build from the ui directory, instead I get the error.
RESTEASY003210: Could not find resource for full path: http://127.0.0.1:8080/testing/index.html
How to Reproduce?
test-me.zip
maven clean package
java -jar target/quarkus-app/quarkus-run.jar
Browser to
http://127.0.0.1:8080/testing/index.html
Which will fail.
Output of
uname -a
orver
Darwin xxxxxx 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101 arm64
Output of
java -version
openjdk version "11.0.11" 2021-04-20 LTS OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.1.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /Users/brent/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.11, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home Default locale: en_NZ, platform encoding: UTF-8 OS name: "mac os x", version: "11.5.2", arch: "aarch64", family: "mac"
Additional information
It uses the following maven plugin to copy the UI into place, normally it would be a dist directory under ui build from VueJS, but I have simplified it down for this example.
No response
The text was updated successfully, but these errors were encountered: