Skip to content
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

compressedMimeTypes property does not work as expected #8938

Open
jprakashbabu opened this issue Jun 18, 2024 · 1 comment
Open

compressedMimeTypes property does not work as expected #8938

jprakashbabu opened this issue Jun 18, 2024 · 1 comment

Comments

@jprakashbabu
Copy link

jprakashbabu commented Jun 18, 2024

Hi,

I am using dropwizard 2.1.11 and enabled compression for certain mime types using the configuration option compressedMimeTypes
as shown below.
compressedMimeTypes : text/html,text/xml,application/x-javascript,text/javascript,text/css
and see that application/x-javascript is not getting compressed even though its there in the list

HTTP/1.1 200 OK
Date: Tue, 11 Jun 2024 20:02:31 GMT
Cache-Control: public, max-age=31536000
Date: Tue, 11 Jun 2024 20:02:31 GMT
Accept-Ranges: bytes
Content-Type: application/x-javascript
Last-Modified: Sat, 01 Jun 2024 20:44:38 GMT
Transfer-Encoding: chunked

However if I don't specify any compressedMimeTypes and leave the default values to get picked up, application/x-javascript gets compressed (Content-Encoding: gzip)

HTTP/1.1 200 OK
Date: Tue, 11 Jun 2024 19:47:54 GMT
Cache-Control: public, max-age=31536000
Date: Tue, 11 Jun 2024 19:47:54 GMT
Accept-Ranges: bytes
Content-Type: application/x-javascript
Last-Modified: Sat, 01 Jun 2024 20:44:38 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Transfer-Encoding: chunked
Can you please let me know if I am missing something here (or) is the exclude list taking precedence over the include ?

PS: Both the above requests were identical and had Accept-Encoding:gzip, deflate, br, zstd

thanks,
Prakash

@zUniQueX
Copy link
Member

Hi @jprakashbabu. Dropwizard 2.1.11 and the provided Jetty version 9.4.53 are out of support, so please migrate to a more recent Dropwizard version. In general, we won't provide full support for versions announced to be EOL. The correct place would be the discussion board. Please don't raise a discussion and an issue, usually only one option fits 😉

That being said, I don't see an issue here. When using your include list

server:
  gzip:
    enabled: true
    compressedMimeTypes:
      - text/html
      - text/xml
      - application/x-javascript
      - text/javascript
      - text/css

my JS file gets compressed correctly.

Can you please let me know if I am missing something here (or) is the exclude list taking precedence over the include ?

When checking, if the MIME-type should be compressed, Jetty first evaluates the include list and then additionally validates, that the type is not in the exclude list. The default exclude list however doesn't list application/x-javascript as an excluded MIME-type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants