Closed toddz2000 closed 8 years ago
Try listing all the headers and see if something like X-Forwarded-For is included. Put the following code in one of the request handlers:
header_items = self.request.headers.get_all()
for header_item in header_items:
log.info("header: [%s] value: [%s]", header_item[0], header_item[1])
In my case I get this:
INFO:app.py:303::header: [Accept] value: [*/*]
INFO:app.py:303::header: [Host] value: [hdfgroup.org]
INFO:app.py:303::header: [User-Agent] value: [python-requests/2.8.1]
INFO:app.py:303::header: [Accept-Encoding] value: [gzip, deflate]
INFO:app.py:303::header: [Connection] value: [keep-alive]
It works now. I did not realize that the code has to be indented. IndentationError: expected an indented block
I put the code where I found remote_ip(took a while) and tested it. Didn't work the way I wanted. Found another area in class RootHandler(BaseHandler) I decided to add where I found log.info("fielpath....)
root_uuid = response['root']
header_items = self.request.headers.get_all()
for header_item in header_items:
log.info("X-header: [%s] value: [%s]", header_item[0], header_item[1])
filePath = self.getFilePath(domain)
I works. I'm happy. I will not touch it.
Thanks ~todd
Great, you are on your way to being a Python expert! :)
I'll keep this issue open - I'd like to restructure the code have a shared method for logging calls with config based options for what to log (as described above).
Thanks I did notice when I click on different url's, I will not see the source IP's. I need to put that syntax in many other places. :o( Other than that, the code works perfectly. :o)
@toddz2000, I've recently setup h5serv running through a nginx proxy, and ran into some of the same issues. I've checked in code to the develop branch to properly log the X-Forwarded proto, host, and ip. Also the hateos hrefs are updated to reflect the user facing url, not the inner url.
If you have a second, I'd appreciate you trying out the latest code and letting me know if you run into any problems with F5.
Hi John,
I wouldn’t get to it for about 2 weeks.
Do I just replace all the files in the server directory?
I did download the zip file.
Talk to you soon. Thanks,
~todd
Todd Zenker BLDG28 W253 ADNET Systems
Hi Todd,
If you have git installed on the server system, the easiest thing to do is to back out any changes you've made in the mean time (git status will show you what files you've modified), and then do a git update
to pull in the latest updates. Or you can move the entire h5serv tree to somewhere else and do a fresh clone: `git clone https:``https://github.com/HDFGroup/h5serv```. Downloading the zip file works too. :)
John
@toddz2000: btw, if you are comfortable with docker the easiest option would be to pull the image from Docker Hub: https://hub.docker.com/r/hdfgroup/h5serv/. You can start the server with:
docker run -d -p 5000:5000 -v <your_data_dir>:/data --name h5serv --env DOMAIN='yourdomain.org' hdfgroup/h5serv
I haven't heard back on this issue, so will assume the commit fixed the issue.
Hello,
I have enable X-Forward-For on the F5 local traffic manager and in my logs I get the ipaddress of the F5 itself. replaced this with the 2 lines below in the app.py log.info('remote_ip: ' + self.request.remote_ip)
How can I resolve this??
Thanks ~todd