Nginx Proxy and Spring Application context
Asked by Doc Magic:

I am having some issue configuring the Nginx Proxy to work with Confluence. I have Confluence configured and serving on localhost:8090 which I am using Nginx proxy configuration from the official documentation. I did not set a "/confluence" context path as I prefer to keep it at the root level. However, as soon as I started Nginx after Confluence is running, there are large amount of stack traces thrown with similar detail as below.

```
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLocale' in  class com.atlassian.confluence.core.ConfluenceActionSupport threw exception java.lang.IllegalStateException: Spring Application context has not been set at /decorators/includes/header.vm[line 58, column 41]        at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)        at org.apache.velocity.context.ProxyVMContext.get(ProxyVMContext.java:222)        at org.apache.velocity.runtime.parser.node.ASTReference.getVariableValue(ASTReference.java:843)        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:222)        at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)        at org.apache.velocity.runtime.parser.node.ASTStringLiteral.value(ASTStringLiteral.java:290)        at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)        at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)        at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)        at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)        at com.atlassian.confluence.setup.velocity.TrimDirective.render(TrimDirective.java:33)        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)        at com.atlassian.confluence.setup.velocity.ProfilingParseDirective.render(ProfilingParseDirective.java:21)        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)        at org.apache.velocity.Template.merge(Template.java:328)        at org.apache.velocity.Template.merge(Template.java:235)        at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:68)        at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:76)        at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator$StreamingResponseWritingStrategy.renderToResponse(ConfluenceSitemeshDecorator.java:291)        ... 58 more
```

How can I make this work properly?


Answers:
author: AnnWorley
body: The error you posted is almost identical to one of the ones listed on [Confluence does not start due to Spring Application context has not been set](https://confluence.atlassian.com/confkb/confluence-does-not-start-due-to-spring-application-context-has-not-been-set-218278311.html). Please review the resolutions in the knowledge base article.

Are you reporting that you only see this error when the proxy is enabled? Does Confluence run as expected when you don't start NGINX?