Jump to content

Proxying a client request - pass client IP address


sephrat

Recommended Posts

sephrat

I'm contributing on an app that uses Emby authentication to allow access to our app.

At the moment, the login activity shows under the IP address of the server that runs the app. I'd like Emby to show the IP of the end user.

I tried to set X-Forwarded-For and/or X-Real-IP, but Emby will always display my IP address instead of the one I set.

curl --location 'http://redacted/emby/users/authenticatebyname' \
--header 'X-Emby-Authorization: MediaBrowser Client="Test", Device="Test", DeviceId="test", Version="test"' \
--header 'X-Forwarded-For: 192.168.2.123' \
--header 'X-Real-IP: 192.168.2.123' \
--form 'username="redacted"' \
--form 'pw="redacted"'

Result:

image.png.3d829319462e082886d4ce74ce0d4e31.png

I'm assuming this is for security reason, but people do manage to trick it with reverse proxies, so what's the trick?

Additional question: if I manage to make it work, would Emby count several devices (one for each forwarded IP address) instead of a single device (the app server), thus bringing us closer to the Premiere device limit?

 

Link to comment
Share on other sites

Hi, what app? in the upcoming 4.8 server release there will be no way to do this, although we're open to suggestions on possible improvements.

You can still use those headers to specify a remote ip, but you won't be able to use them to specify a LAN ip, and this is for security reasons to prevent a remote connection from being able to trick the server into thinking it's on the local network.

Link to comment
Share on other sites

sephrat

Ah right, I should have tested with a WAN IP address. Thanks for the detailed answer, it does work now.

From my first tests, it seems that the "Test" device I used is still counted as a single device even when logging in with different accounts and IP addresses. I assume this is because we use a unique DeviceId, correct?

The app is Ombi. We're only using Emby as some sort of LDAP provider. I don't believe this is even considered as a Premiere feature, right?

Edited by sephrat
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...