I'm trying out nginx. I would like to use it to perform the following:
I've got SSI working when using a local file, but not when using the page from a server1 using proxy_pass.
Here's my config I'm using to try to achieve the above.
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/;
}
}
}
For testing purposes, I'm using a simple SSI command, as shown in the output my browser actually ends up with, which is identical to the content on server1:
<html>
<!--# set var="test" value="Hello nginx!" -->
<!--# echo var="test" -->
</html>
Do I need to use something other than proxy_pass, or is it just not possible? Thanks!
Make sure that server1 is not returning compressed content. if its being returned gzipped, nginx won't uncompress it to apply the ssi rules to it.
you can ensure the reponse 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/;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With