apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.36k stars 365 forks source link

Preserve URLs options doesn't exist #1671

Open michael-rubel opened 4 years ago

michael-rubel commented 4 years ago

These parameters always false: pagespeed ImagePreserveURLs true; pagespeed CssPreserveURLs true; pagespeed JsPreserveURLs true;

I'm checked sources and got that these options exist in Apache version of PageSpeed but not in Nginx version.

jmarantz commented 4 years ago

What version of PageSpeed do you have installed in nginx?

On Mon, Dec 9, 2019 at 8:33 AM observer.name notifications@github.com wrote:

These parameters always false: pagespeed ImagePreserveURLs true; pagespeed CssPreserveURLs true; pagespeed JsPreserveURLs true;

I'm checked sources and got that these options exist in Apache version of PageSpeed but not in Nginx version.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1671?email_source=notifications&email_token=AAO2IPKHEANNVZNUJRV6OMLQXZCI3A5CNFSM4JYJHTE2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H7COO4Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAO2IPLHZPBDR4RFWKMTJM3QXZCI3ANCNFSM4JYJHTEQ .

michael-rubel commented 4 years ago

What version of PageSpeed do you have installed in nginx?

X-Page-Speed: 1.13.35.2-0

jmarantz commented 4 years ago

To clarify: are you saying that you attempted to use those options in ngx_pagespeed, and startup failed saying those options don't exist?

Or did the startup work, but the behavior was not expected?

Or did you just look at the nginx-specific part of the code where you didn't see those options listed by name?

michael-rubel commented 4 years ago

Startup isn't failed but in /?PageSpeedFilters=+debug these options always false.

I did turn off parameters that can overwrite this (resize_images, resize_rendered_image_dimensions, inline_images).

if (options->image_preserve_urls() &&
      !options->Enabled(RewriteOptions::kResizeImages) &&
      !options->Enabled(RewriteOptions::kResizeToRenderedImageDimensions) &&
      !options->Enabled(RewriteOptions::kInlineImages)) {
    slot->set_preserve_urls(true);
  }

But no result. Next I tried to disable all the filters and change RewriteLevel to OptimizeForBandwidth, but no result - Preserves still False.

In the code, I don't see any Preserve options in Nginx version. Don't know, maybe it includes some Apache files while compiling ngx module but I don't see it working on my server.

jmarantz commented 4 years ago

Yeah the code structure is not ideal due to the history of how the apache and nginx versions were developed. mod_pagespeed repo includes all the core functionality needed for all server types, and the nginx repo contains only the nginx-specific gasket.

I am pretty sure preserve-URLs works fine in nginx and there must be something about your vhost/config structure that's overriding them.

michael-rubel commented 4 years ago

rewrite

Something here can override it? Just turned whole config off;

jmarantz commented 4 years ago

can you share the whole config?

michael-rubel commented 4 years ago

Ok, here's the whole config. All the parameters I turned off in test is turned on; [config.zip]

Lofesa commented 4 years ago

Hi @ObserverMichael Maybe not related but you have this; pagespeed Disallow wildcard_spec; in optimize.conf.

In nginx config files how these files are included? I see that optimize.conf includes filters.conf, but admin and main? Can you share a url to test?

michael-rubel commented 4 years ago

Hi @ObserverMichael Maybe not related but you have this; pagespeed Disallow wildcard_spec; in optimize.conf.

In nginx config files how these files are included? I see that optimize.conf includes filters.conf, but admin and main? Can you share a url to test?

I disabled that in the test above, no result.

Lofesa commented 4 years ago

I will say that wilcard_spec is literal in the config file, they must be a regex expresion like or /name....

michael-rubel commented 4 years ago

I will say that wilcard_spec is literal in the config file, they must be a regex expresion like or /name....

Yeah I know, I will remove that in production. Thanks for the advice.

Lofesa commented 4 years ago

Hi @ObserverMichael Can you post the configuration page of the admin? https://www.modpagespeed.com/doc/admin

michael-rubel commented 4 years ago

can you share the whole config?

So, any mistakes in the config that able to override PreserveURLs?