Using nginx, how do I run SSI on the page returned from another server?

I am trying nginx. I want to use it to perform the following operations:

>Retrieve pages containing some SSI commands from server1
> Process SSI commands and finally include content from server2
>Return result page

I have SSI work when using local files, but not when using proxy_pass to use pages from server1.

This is the configuration I used to try to achieve the above.

events {
worker_connections 1024;
}
http {< br /> server {
listen 80;
server_name localhost;

location /hello-world.html {
ssi on;
proxy_pass http:/ /tom.office.bla.co.uk:8080/hello-world/;
}
}
}

For testing purposes, I am using a simple The SSI command, as shown in the actual final output of my browser, which is the same as the content on server1:






Do I need to use anything other than proxy_pass, or is it possible? Thanks!

make sure server1 does not return compressed content. If it is returned to gzip, nginx will not decompress it To apply the ssi rule to it.

You can ensure that the response is returned in plain text by clearing the Accept-Encoding header:

location / hello-world.html {
ssi on;
proxy_set_header Accept-Encoding "";
proxy_pass http://tom.office.bla.co.uk:8080/hello-world/;
}

I’m trying nginx. I want to use it to do the following:

>Retrieve contains from server1 Some SSI command pages
>process SSI commands and finally include content from server2
>return result page

I have SSI work when using local files, but I use proxy_pass from server1 There is no page.

This is the configuration I used to try to achieve the above purpose.

events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;

location /hello-world.html {
ssi on ;
proxy_pass http://tom.office.bla.co.uk:8080/hello-world/;
}
}
}

out For testing purposes, I am using a simple SSI command, as shown in the actual final output of my browser, which is the same as the content on server1:

< html>




Do I need to use anything other than proxy_pass, or is it possible? Thanks!

Make sure that server1 does not return compressed content. If it is returned to gzip, nginx will not decompress it to apply ssi rules to it.

< /p>

You can ensure that the response is returned in plain text by clearing the Accept-Encoding header:

location /hello-world.html {
ssi on ;
proxy_set_header Accept-Encoding "";
proxy_pass http://tom.office.bla.co.uk:8080/hello-world/;
}

Leave a Comment

Your email address will not be published.