librespeed / speedtest

Self-hosted Speed Test for HTML5 and more. Easy setup, examples, configurable, mobile friendly. Supports PHP, Node, Multiple servers, and more
https://librespeed.org
GNU Lesser General Public License v3.0
12.19k stars 2.2k forks source link

IP reported as null when proxied through Apache #609

Open bobbyl140 opened 7 months ago

bobbyl140 commented 7 months ago

Description

I use the Docker container of librespeed from linuxserver.io behind an Apache reverse proxy. When taking a speed test, my client IP always shows as null. I have set the X-Forwarded-For header, which works in other applications. I originally asked the linuxserver team about this, and they suggested Apache might be unsupported which isn’t something they control, and that there’s more to the IP check then that one header.

Server

Apache: 2.4.57 Podman: 4.6.1 Container: registry.gitlab.com/linuxserver.io/docker-librespeed/librespeed:latest

Client

Safari and Firefox on macOS 14.4, Microsoft Edge and Firefox on Windows 11 21H2, Safari on iOS 17.4.1

Steps to reproduce

Expected behaviour

The IP should show.

Screenshots

IMG_9517 (Will upload a screenshot of network debugging when I’m at my computer later today)

bobbyl140 commented 7 months ago

Sorry, sent early. About to finish filling out

sstidl commented 7 months ago

The image mentioned by you is not made by us so i don't know the difference. Regarding the unknown ISP issue, you find other issues with the solution here.

sstidl commented 7 months ago

Duplicate of #603

bobbyl140 commented 7 months ago

It’s more than just an unknown ISP, the IP address is showing as null too. They said they couldn’t help me because they didn’t make the software, so I’m not quite sure what else to do.

sstidl commented 6 months ago

Have you tried to use our image?

bobbyl140 commented 6 months ago

I had not actually, I just tried it and the same thing occurs. Here's my docker-compose.yml:

version: '3.7'
services:
  speedtest:
    container_name: speedtest
    image: ghcr.io/librespeed/speedtest:dev
    restart: always
    volumes:
      - ./speedtest/db:/database
    environment:
      MODE: standalone
      TELEMETRY: true
      PASSWORD: REDACTED
      EMAIL: admin@example.com
      DISTANCE: mi
    ports:
      - "9065:80"
bobbyl140 commented 5 months ago

@sstidl any update on this? if not sorry to comment.

sstidl commented 5 months ago

This problem is incomprehensible to me. Sorry. It has to be related to something in your own environment.

sstidl commented 5 months ago

I took the exact docker-compose.yml from above and it works on a linux docker host without any modification. see screenshot:

image
bobbyl140 commented 5 months ago

I’ll see if I can figure it out then, but keep in mind I’m using this through Apache as a reverse proxy. In that image the URL is directly to the container, as shown by the port number. But I’ll see what I can do.

sstidl commented 5 months ago

if you are using a revproxy you have to learn how to forward the correct headers. look for "X-Forwarded-For"-Header it depends on your rev-proxy how to configure it right. in my own scenario i use nginx as rev.proxy.

bobbyl140 commented 5 months ago

But like I said, I've set this header globally on my reverse proxy and it works just fine with all other Docker containers I run. For example, the Bookstack container I run in Docker:

Screenshot 2024-05-18 at 4 59 45 PM
bobbyl140 commented 1 month ago

Sorry to bump this but it's been a long time and I still haven't figured it out. Is there anything else I can try?

sstidl commented 1 month ago

Sorry to say but this is not a problem related to speedtest. I can't help you there.