dev-proxy-logging: Add client ip transference to proxy server.

- Add rewriting 'X-REAL-IP' header for each request through dev
  proxy server.
- Change webpack configuration ip to 0.0.0.0 to fix socket.io build
  for launching remote dev server.
This commit is contained in:
K.Kanakhin 2016-12-21 16:40:22 +06:00
parent 4750d30341
commit e122dcab5c
2 changed files with 4 additions and 2 deletions

View File

@ -288,6 +288,8 @@ class CombineHandler(BaseWebsocketHandler):
@web.asynchronous @web.asynchronous
def prepare(self): def prepare(self):
# type: () -> None # type: () -> None
if 'X-REAL-IP' not in self.request.headers:
self.request.headers['X-REAL-IP'] = self.request.remote_ip
if self.request.headers.get("Upgrade", "").lower() == 'websocket': if self.request.headers.get("Upgrade", "").lower() == 'websocket':
return super(CombineHandler, self).prepare() return super(CombineHandler, self).prepare()
url = transform_url( url = transform_url(

View File

@ -1,11 +1,11 @@
module.exports = { module.exports = {
entry: [ entry: [
'webpack-dev-server/client?http://127.0.0.1:9991/socket.io', 'webpack-dev-server/client?http://0.0.0.0:9991/socket.io',
'./static/js/src/main.js', './static/js/src/main.js',
], ],
devtool: 'eval', devtool: 'eval',
output: { output: {
publicPath: 'http://127.0.0.1:9991/webpack/', publicPath: 'http://0.0.0.0:9991/webpack/',
path: './static/js', path: './static/js',
filename: 'bundle.js', filename: 'bundle.js',
}, },