title: Cherrypy deployment - Nginx - javascript
body: <p>I build an app on a server, with the goal of putting it behind Nginx.</p>
  
  <p>the app is actually tutorial8 from the cherrypy examples (or close to it).</p>
  
  <p>The nginx configuration:</p>
  
  <pre><code>location /Cloning/ {    
  proxy_set_header    Host                $host;
      proxy_set_header    X-Real-IP           $remote_addr;
      proxy_set_header    X-Forwarded-For     $remote_addr;
  proxy_set_header    X-Originating-IP    $remote_addr;
      proxy_set_header    HTTP_REMOTE_ADDR    $remote_addr;
      proxy_set_header    REMOTE_ADDR         $remote_addr;
      proxy_set_header    CLIENT_IP           $remote_addr;
      proxy_pass http://0.0.0.0:8088/;
  }
  </code></pre>
  
  <p>the app runs as expected (the javascript is working) when accessing under server_name:8088 (the cherrypy webserver was configured to serve the page on that page).
  However, When I want to connect to it through the Nginx location, server_name/Cloning/, the javascript is not working.
  What do I miss, or what should I check?
  I suppose it has to do with nginx, as the app works as a charm when directly connecting to it, but it doesn't when connecting over nginx...</p>
  
  <p>Any suggestion would be appreciated.</p>
  
  <p>cherrypy code</p>
  
  <pre><code>#!/usr/bin/env python3
  import cherrypy
  import os
  from app import *
  
  #app = cherrypy.tree.mount(InbioseCloning(), '/')
  
  if __name__=='__main__':
  
      cherrypy.config.update({
      'server.socket_host': '0.0.0.0',
      'server.socket_port': 8088,
      'log.access_file' : './logs/log_access.txt',
      'log.screen' : True,
      'log.error_file' : './logs/log_error.txt'
      })
  
   conf = {
      '/': {
          'tools.sessions.on': True,
          'tools.staticdir.root': os.path.abspath(os.getcwd()),
          'tools.sessions.timeout':60
      },
      '/projectfetcher': {
          'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
          'tools.response_headers.on': True,
          'tools.response_headers.headers': [('Content-Type', 'text/plain')],
      },
      '/static': {
          'tools.staticdir.on': True,
          'tools.staticdir.dir': './public'
      },
      '/data_folder': {
          'tools.staticdir.on': True,
          'tools.staticdir.dir': './data_folder'
      }
   }
  
  
  webapp = CloningHomepage()
  webapp.projectfetcher = ProjectFetcherService()
  # webapp.lvl1creatorservice = Lvl1CreatorService()
  # Run the application using CherryPy's HTTP Web Server
  cherrypy.quickstart(webapp,'/', conf)
  </code></pre>