vaadin / spring

Spring integration for Vaadin
https://vaadin.com/start
177 stars 101 forks source link

Static file server seems to not work when accessed via `/vaadinServlet` #851

Open fluorumlabs opened 3 years ago

fluorumlabs commented 3 years ago

Steps to reproduce:

  1. Generate Spring Boot-based SVC project
  2. Start application
  3. Navigate to http://localhost:8080/vaadinServlet
  4. Observe that the image in the app layout is not shown: request to http://localhost:8888/vaadinServlet/images/logo.png returns HTML.
miguelatvaadin commented 3 years ago

Hi @fluorumlabs ,

could you please tell which version of Vaadin have you chosen?

Thanks,

fluorumlabs commented 3 years ago

I've been testing with Vaadin 20.0.0.beta1 / Flow 7.0.0.beta3

miguelatvaadin commented 3 years ago

I understand that it is related to vaadin/spring#802, when using VaadinWebSecurityConfigurerAdapter

fluorumlabs commented 3 years ago

It's not related to Spring Security.

  1. Open https://labs.vaadin.com/edit-multiple/vaadinServlet/
  2. Observe "broken" image in the top left corner
  3. Image URL is https://labs.vaadin.com/edit-multiple/vaadinServlet/images/logo.png
miguelatvaadin commented 3 years ago

Ok. Great. Thanks for point it out, @fluorumlabs.

miguelatvaadin commented 3 years ago

So, when accessing the vaadin servlet directly (as it is published at /vaadinServlet by the spring plugin) to serve the app it is not serving the static content as it is not recognized as a static resource.

Removing the servlet path when calling getStaticResource inside StaticFileServer#isStaticResourceRequest would solve the issue.

The described behavior is the same for V14

mshabarov commented 2 years ago

To be re-tested with latest Vaadin version (23.2).

Artur- commented 2 years ago

Why should this work? /vaadinServlet/ should preferrably not even be available for direct use