Accessing 'x-forwarded-for' request header from Bokeh app?

I’m wondering if it’s possible for a Bokeh app to identify user IP address. In other Python web-frameworks, I can access to HTTP request headers including ‘x-forwarded-for’ but not too clear if this would be possible for Bokeh?

I have a simple weather data downloader app ( that uses Bokeh as a frontend UI and a librarian asked about allowing users accessing the service from the library WiFi without signing up. They do this for some other data services so am wondering how I would implement this.

Any help would be greatly appreciated!


You can define a request hook handler to access the entire original HTTP request:

The dict returned by the function you provide will be made available to the session as the token_payload.

That’s perfect - thank you very much for the help @Bryan!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.