cherrypy.HTTPRedirect redirects to IP instead of hostname using abs path

前端 未结 2 995
故里飘歌
故里飘歌 2021-01-03 16:44

I\'m running CherryPy behind nginx and need to handle redirects. On my dev machine running on 127.0.0.1:8080, this redirects correctly to 127.0.0.1:8080/login.

Howe

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-03 17:17

    Try tools.proxy config setting:

    'tools.proxy.on': True,
    

    Additionally you may need

    'tools.proxy.local': 'X-Forwarded-Host',
    

    Set to appropriate header. When using NGINX, the header would be

    'tools.proxy.local': 'Host',
    

    In case of Lighttpd this header will be appropriate:

    'tools.proxy.local': 'X-Host'
    

提交回复
热议问题