Advanced Nginx Configuration

Its time that we start configuring our nginx application to talk to the backend service and do some real data manipulation.

Steps

  • Copy over the default nginx.conf provided by the buildpack from here, commit
  • remove unwanted lines: commit
  • Hardcod the server URL as the proxy commit
  • But Hard code won't work, the server URL may change with environment, like DEV/production/QA, So we have to externalize the configuration. commit
    • Explanation: The Static buildpack uses something called ERB to template the nginx.conf
    • Reference to Buildpack code that does the erb
    • So basically <%= ENV["TODO_SERVER_URL"] %> entry gets replaced into https://todo-server.run.aws-usw02-pr.ice.predix.io which happens to be the env in manifest.yml
    • So now any request to todo-client.run.aws-usw02-pr.ice.predix.io/todo will be redirected to todo-server succefully
  • Complete list of changes can be found in Pull Request

References