incubator-pagespeed-ngx icon indicating copy to clipboard operation
incubator-pagespeed-ngx copied to clipboard

data-pagespeed-lsc-url

Open smokenik opened this issue 2 years ago • 14 comments

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?

smokenik avatar Mar 28 '23 12:03 smokenik

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

Lofesa avatar Mar 31 '23 16:03 Lofesa

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 |

smokenik avatar Mar 31 '23 17:03 smokenik

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.

Lofesa avatar Apr 01 '23 11:04 Lofesa

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: @.***>

--

smokenik avatar Apr 03 '23 12:04 smokenik

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?

Lofesa avatar Apr 03 '23 15:04 Lofesa

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 avatar Apr 03 '23 15:04 smokenik

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 |

smokenik avatar Apr 03 '23 15:04 smokenik

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?

Lofesa avatar Apr 03 '23 15:04 Lofesa

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 |

smokenik avatar Apr 03 '23 16:04 smokenik

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

Lofesa avatar Apr 03 '23 16:04 Lofesa

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 |

smokenik avatar Apr 03 '23 16:04 smokenik

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"

Lofesa avatar Apr 03 '23 17:04 Lofesa

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

smokenik avatar Apr 04 '23 08:04 smokenik

In the pagespeed config file you mus have some like

location / {
    proxy_pass http://your-backend-server.com
     .......
}

Note the http protocol.

This way you have some like

user -> https -> nginx -> http -> backend_server

If you use https://test.accise.net:80/ as the backend_server then you still have a ssl comunication between the nginx proxy and the backend_server.

Can you share a link to these test server ? If you can I can test it live, and maybe figure whats is happend

Lofesa avatar Apr 04 '23 11:04 Lofesa