Elie Steinbock
Elie Steinbock

Reputation: 5098

Meteor, prerender.io, Nginx and SSL

I'm trying to get prerender.io working for my Meteor app with the Nginx configuration, but not sure exactly how to integrate it.

I've done something similar to the following: https://www.digitalocean.com/community/questions/how-to-setup-prerender-io-on-my-mean-stack-application-running-behind-nginx

By putting the http proxy stuff in the section:

if ($prerender = 0) {
    #the directives
}

But have the issue of:

nginx: [emerg] "proxy_http_version" directive is not allowed here in /etc/nginx/sites-enabled/annachristoffer:48
nginx: configuration file /etc/nginx/nginx.conf test failed

Been stuck on this for a while and can't seem to find a source online that explains it.

Upvotes: 0

Views: 286

Answers (1)

Richard Smith
Richard Smith

Reputation: 49752

The error means that the proxy_http_version directive is not allowed to be used inside an if block. The documentation specifies a context for each directive. For example, the proxy_pass directive is allowed to be used inside an if block.

Many of nginx directives can be inherited from an outer block, so it may be possible for you to restructure your configuration like this:

proxy_http_version ...;
proxy_... ...;

if ($prerender = 0) {
    ...;
    proxy_pass ...;
}

Please be aware that the use of if comes with a caution.

Upvotes: 1

Related Questions