Skip to content

Missing resource handling configuration when separate management context is configured #25113

@derTobsch

Description

@derTobsch

If we configure the management.server.port and this one is not equal to server.port via spring.web.resources.chain.strategy.content.* generation of the hash does not work and we do not get the correct hashs on the files. If there are some information about this in docs please hint me to it. Otherwise here are an example how to reproduce it:

Id you start this docker-compose file everything will be configured for you and the hashing of the assets in /css/** e.g. does work.
Take a look at http://localhost:8080/login with the developer console in Chrome/Firefox e.g. and see that the style.css e.g. does have a hash and if we add the MANAGEMENT_SERVER_PORT=8081 we do not see the hashes.
The common.$hash.css file can be ignored this is not placed in /css/** and will be generated via webpack.

version: '2.4'
services:
  mariadb:
    image: mariadb:10.5
    ports:
      - '3308:3306'
    environment:
      - MYSQL_DATABASE=urlaubsverwaltung
      - MYSQL_USER=urlaubsverwaltung
      - MYSQL_PASSWORD=urlaubsverwaltung
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
  mailhog:
    image: mailhog/mailhog:v1.0.0
    ports:
      - '1025:1025'
      - '8025:8025'
  uv:
    image: synyx/urlaubsverwaltung:latest
    ports:
      - '8080:8080'
    environment:
      - SPRING_MAIL_HOST=mailhog
      - SPRING_MAIL_PORT=1025
      - [email protected]
      - [email protected]
      - UV_MAIL_APPLICATION-URL=http://localhost:8080
      - SPRING_DATASOURCE_URL=jdbc:mariadb://mariadb:3306/urlaubsverwaltung
      - UV_SECURITY_AUTH=default

But know if I add the management.server.port the hash of /css/** files e.g. is not generated

version: '2.4'
services:
  mariadb:
    image: mariadb:10.5
    ports:
      - '3308:3306'
    environment:
      - MYSQL_DATABASE=urlaubsverwaltung
      - MYSQL_USER=urlaubsverwaltung
      - MYSQL_PASSWORD=urlaubsverwaltung
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
  mailhog:
    image: mailhog/mailhog:v1.0.0
    ports:
      - '1025:1025'
      - '8025:8025'
  uv:
    image: synyx/urlaubsverwaltung:latest
    ports:
      - '8080:8080'
    environment:
      - SPRING_MAIL_HOST=mailhog
      - SPRING_MAIL_PORT=1025
      - [email protected]
      - [email protected]
      - UV_MAIL_APPLICATION-URL=http://localhost:8080
      - SPRING_DATASOURCE_URL=jdbc:mariadb://mariadb:3306/urlaubsverwaltung
      - UV_SECURITY_AUTH=default
      - MANAGEMENT_SERVER_PORT=8081

The default application properties that we add in the given docker container can be seen here https://github.com/synyx/urlaubsverwaltung/blob/master/src/main/resources/application.properties#L30

Do you have any information for us, if this is a common behaviour and how we can achieve having hashed css files and split the server and management port?

Hint: This is independent from docker. I have the same behaviour via ide, 'java -jar ...' and so on :-)

Metadata

Metadata

Assignees

Labels

for: external-projectFor an external project and not something we can fixstatus: supersededAn issue that has been superseded by another

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions