apache / incubator-pagespeed-ngx

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

data-pagespeed-lsc-url #1765

Open smokenik opened 1 year ago

smokenik commented 1 year ago

it expose :80 at the end of the url of the data-pagespeed-lsc-url ... for example:

...href="assets/css/style.css" data-pagespeed-lsc-url="https://xxx.domain.net:80/assets/css/style.css">

Is it correct?... What Can I do to fix it?

Lofesa commented 1 year ago

Hi Are the resources proxied? Sounds strange an ssl site in the port 80

smokenik commented 1 year ago

Yes behind Nginx reverse proxy ( Nginx proxy manager)

Il giorno ven 31 mar 2023 alle 18:31 Lofesa @.***> ha scritto:

Hi Are the resources proxied? Sounds strange an ssl site in the port 80

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1492239122, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJXSOHG6MA2QE6SKZPDW64BFBANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

--

| Nicola Cabras |

Lofesa commented 1 year ago

Have you enabled the rewrite domain? Because it seems your proxy send the request to the 80 port, some like

user ->https-> nginx -> http -> backend-server

So maybe you need 2 things: 1.- A header X-Forwarded-Proto to instruct the backend server the client is using the https protocol 2.- A pagespeed directive to rewrite the domain mydomain.com:80 to mydomain.com in the response html code

In other hand, maybe you need to set the X-Forwarded-for to pass the client ip to the backend, because if you have any security measure like fail2-ban, maybe you are banning the proxy ip and not the user ip.

smokenik commented 1 year ago

same problem... I am going crazy

same site:

1)nginx proxy manager (http) -> OLS (http)+ modpagespeed ALL FINE! combine and resize .js .css, transform in webp ok trim spaces, lower html, delete comments

2)nginx proxy manager (https) -> OLS (http)+ modpagespeed NOT combine NOT resize images ok trim spaces, lower html, delete comments

Assuming xx.yyy.net the domain ... how to set modpagespeed directives to fix 2) ?

http headers list:

Host: xx.yyyy.net X-Forwarded-Schem: https X-ForProto -Proto: https X-Forwarded-For: 192.168.20.195 X-Real-IP: 192.168.20.195 Connection: close sec-ch-ua: "Brave";v="111", "Not(A:Brand";v="8", "Chromium";v="111" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" upgrade-insecure-requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8 sec-gpc: 1 Accept-Language: it-IT,it;q=0.8 sec-fetch-site: none sec-fetch-mode: navigate sec-fetch-user: ?1 sec-fetch-dest: document Accept-Encoding: gzip, deflate, br

Il giorno sab 1 apr 2023 alle ore 13:55 Lofesa @.***> ha scritto:

Have you enabled the rewrite domain? Because it seems your proxy send the request to the 80 port, some like

user ->https-> nginx -> http -> backend-server

So maybe you need 2 things: 1.- A header X-Forwarded-Proto to instruct the backend server the client is using the https protocol 2.- A pagespeed directive to rewrite the domain mydomain.com:80 to mydomain.com in the response html code

In other hand, maybe you need to set the X-Forwarded-for to pass the client ip to the backend, because if you have any security measure like fail2-ban, maybe you are banning the proxy ip and not the user ip.

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1492948581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJS6ZCSL6S3G6SNCNTDW7AJRJANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

--

Lofesa commented 1 year ago

What do you mean with "..same site 1)...."? these are the requested headers from you Brave browser, not the response headers from the web server. Anyway, what have in your server config files?

smokenik commented 1 year ago

Same site same html... In OLS I have done 2 Vhosts

Il giorno lun 3 apr 2023 alle ore 17:13 Lofesa @.***> ha scritto:

What do you mean with "..same site 1)...."? these are the requested headers from you Brave browser, not the response headers from the web server. Anyway, what have in your server config files?

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1494513407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJXQX4KDJ4KTVLVKY33W7LSLJANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

smokenik commented 1 year ago

1)NGINX Proxy Manager (https) :443 -> OLS: (https) :4435

with this one works fine:

module modpagespeed { pagespeed on pagespeed InPlaceResourceOptimization on pagespeed FetchHttps enable,allow_self_signed pagespeed FileCachePath /tmp/lshttpd/modpagesp10/ pagespeed EnableFilters remove_comments pagespeed EnableFilters collapse_whitespace pagespeed LowercaseHtmlNames on pagespeed EnableFilters extend_cache_pdfs pagespeed EnableFilters combine_css pagespeed EnableFilters rewrite_css pagespeed EnableFilters extend_cache,rewrite_images pagespeed EnableFilters rewrite_javascript pagespeed FetcherTimeoutMs 5000 pagespeed XHeaderValue "Powered By ngx_pagespeed" pagespeed EnableFilters inline_css

}

I have problem with Offloading SSL:

1)NGINX Proxy Manager (https) :443 -> OLS: (http) :85

module modpagespeed { pagespeed on pagespeed InPlaceResourceOptimization on pagespeed FetchHttps enable,allow_self_signed pagespeed FileCachePath /tmp/lshttpd/modpagesp10/ pagespeed EnableFilters remove_comments pagespeed EnableFilters collapse_whitespace pagespeed LowercaseHtmlNames on pagespeed EnableFilters extend_cache_pdfs pagespeed EnableFilters combine_css pagespeed EnableFilters rewrite_css pagespeed EnableFilters extend_cache,rewrite_images pagespeed EnableFilters rewrite_javascript pagespeed FetcherTimeoutMs 5000 pagespeed XHeaderValue "Powered By ngx_pagespeed" pagespeed EnableFilters inline_css

}

+ VHost module modpagespeed {

pagespeed FetchHttps disable; pagespeed RespectXForwardedProto on; ModPagespeedMapOriginDomain "http://test.accise.net" " https://test.accise.net"

ModPagespeedMapRewriteDomain "https://test.accise.net:80" "

https://test.accise.net"

}

Il giorno lun 3 apr 2023 alle ore 17:13 Lofesa @.***> ha scritto:

What do you mean with "..same site 1)...."? these are the requested headers from you Brave browser, not the response headers from the web server. Anyway, what have in your server config files?

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1494513407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJXQX4KDJ4KTVLVKY33W7LSLJANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

--

| Nicola Cabras |

Lofesa commented 1 year ago

That look a bit confussing

pagespeed on This a nginx pagespeed directive but ModPagespeedMapOriginDomain is an apache pagespeed directive.

How have you installed the pagespeed module? What the package name?

smokenik commented 1 year ago

https://openlitespeed.org/kb/openlitespeed-pagespeed-module/

I have installe dockerized Openlitespeed with modpagespeed NGINX syntax as infos

Il giorno lun 3 apr 2023 alle ore 17:58 Lofesa @.***> ha scritto:

That look a bit confussing

pagespeed on This a nginx pagespeed directive but ModPagespeedMapOriginDomain is an apache pagespeed directive.

How have you installed the pagespped module? What the package name?

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1494583432, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJQYFF6MRWNBLKF4XHTW7LXSTANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

--

| Nicola Cabras |

Lofesa commented 1 year ago

So I asume the directives are in mod_pagespeed jergon.

https://test.accise.net/?PageSpeedFilters=+debug

In this site pagespeed is working, I can see webp images rewrited by pagesped

smokenik commented 1 year ago

Sure!

The problem When I try To offload ssl!

NGINX Proxy Manager (https) :443 -> OLS: (http) :85

Any Suggestions?

Il giorno lun 3 apr 2023 alle ore 18:16 Lofesa @.***> ha scritto:

So I asume the directives are in mod_pagespeed jergon.

https://test.accise.net/?PageSpeedFilters=+debug

In this site pagespeed is working, I can see webp images rewrited by pagesped

— Reply to this email directly, view it on GitHub https://github.com/apache/incubator-pagespeed-ngx/issues/1765#issuecomment-1494613218, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZTEJXB5X6QPLEDL2UN6ZLW7LZUVANCNFSM6AAAAAAWKO4TIA . You are receiving this because you authored the thread.Message ID: @.***>

--

| Nicola Cabras |

Lofesa commented 1 year ago

Can you do a direct request to http://mysite.com:85? For example from the command line in the server,can you run curl -Iv http://mysite.com:85 If you can do that, what do you see in the html code? I mean if you see some like http://mysite.com:85/some-image.jpg

If you see that, you need

ModPagespeedMapRewriteDomain domain_to_write_into_html domain_specified_in_html

so in your case must be

ModPagespeedMapRewriteDomain "https://test.accise.net" "http//test.accise.net:85"

smokenik commented 1 year ago

Everything I Put in conf... What's Wrong?