[GH-ISSUE #1712] Not catching request if host is an IP address (from within Docker container) #1705

Open
opened 2026-03-03 19:53:39 +03:00 by kerem · 11 comments
Owner

Originally created by @sandrodz on GitHub (Jul 6, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1712

Description

When doing requests directly to an IP address proxyman is not catching requests.

Steps to Reproduce

  1. docker exec into a running container and issue command curl http://google.com request is logged correctly
  2. issue command curl to some IP address curl http://21.72.127.222:8089/api/operation/getPriceTypes request is missing from proxyman
image image

Environment

  • App version: e.g Proxyman 4.8.2
  • macOS version: 13.4.1 (22F82)
  • Docker version: 4.21.0 (113844)
Originally created by @sandrodz on GitHub (Jul 6, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1712 ## Description When doing requests directly to an IP address proxyman is not catching requests. ## Steps to Reproduce 1. docker exec into a running container and issue command `curl http://google.com` request is logged correctly 2. issue command curl to some IP address `curl http://21.72.127.222:8089/api/operation/getPriceTypes` request is missing from proxyman <img width="1091" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/8479569/c0a4e4a8-9f0c-4270-80e4-478ebe6c3b4d"> <img width="1523" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/8479569/d993f534-632f-46dc-af9a-8538038d5de0"> ## Environment - App version: e.g Proxyman 4.8.2 - macOS version: 13.4.1 (22F82) - Docker version: 4.21.0 (113844)
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 7, 2023):

@sandrodz Can you use --proxy localhost:9090 in your cURL command? I guess cURL doesn't send the request (with IP address) to Proxyman, so Proxyman could not capture.

<!-- gh-comment-id:1624846898 --> @NghiaTranUIT commented on GitHub (Jul 7, 2023): @sandrodz Can you use `--proxy localhost:9090` in your cURL command? I guess `cURL` doesn't send the request (with IP address) to Proxyman, so Proxyman could not capture.
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 7, 2023):

Here is example:

curl -v "http://54.204.94.184/get?id=123" --proxy localhost:9090

https://github.com/ProxymanApp/Proxyman/assets/5878421/9f4c2dc6-f0ed-4c54-a6eb-d8cf6c0f5423


If you don't want to use --proxy localhost:9090 flag, you might use Automatic Script and start your docker, run bash in the new Terminal.

It's injected some code (for example, override HTTP_PROXY and HTTPS_PROXY env), so Proxyman can automatically capture all traffic.

<!-- gh-comment-id:1624850949 --> @NghiaTranUIT commented on GitHub (Jul 7, 2023): Here is example: ``` curl -v "http://54.204.94.184/get?id=123" --proxy localhost:9090 ``` https://github.com/ProxymanApp/Proxyman/assets/5878421/9f4c2dc6-f0ed-4c54-a6eb-d8cf6c0f5423 ----------- If you don't want to use `--proxy localhost:9090` flag, you might use [Automatic Script](https://docs.proxyman.io/automatic-setup/automatic-setup) and start your docker, run bash in the new Terminal. It's injected some code (for example, override HTTP_PROXY and HTTPS_PROXY env), so Proxyman can automatically capture all traffic.
Author
Owner

@sandrodz commented on GitHub (Jul 19, 2023):

@NghiaTranUIT I am encountering this from within docker container.
From the local machine it works fine. Like you've demonstrated.

<!-- gh-comment-id:1642069681 --> @sandrodz commented on GitHub (Jul 19, 2023): @NghiaTranUIT I am encountering this from within docker container. From the local machine it works fine. Like you've demonstrated.
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 19, 2023):

@sandrodz Have you tried to start the Docker Container within the Automatic Script Terminal ?

<!-- gh-comment-id:1642072984 --> @NghiaTranUIT commented on GitHub (Jul 19, 2023): @sandrodz Have you tried to start the Docker Container within the [Automatic Script](https://docs.proxyman.io/automatic-setup/automatic-setup) Terminal ?
Author
Owner

@sandrodz commented on GitHub (Jul 19, 2023):

@NghiaTranUIT yes, and result is same. I am not sure how setting env variables helps containers.

<!-- gh-comment-id:1642084299 --> @sandrodz commented on GitHub (Jul 19, 2023): @NghiaTranUIT yes, and result is same. I am not sure how setting env variables helps containers.
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 19, 2023):

@sandrodz can you follow this Doc to setup the HTTP Proxy in Docker env? https://docs.docker.com/network/proxy/

Should point to http://localhost:9090 or http://127.0.0.1:9090

<!-- gh-comment-id:1642113809 --> @NghiaTranUIT commented on GitHub (Jul 19, 2023): @sandrodz can you follow this Doc to setup the HTTP Proxy in Docker env? https://docs.docker.com/network/proxy/ Should point to `http://localhost:9090` or `http://127.0.0.1:9090`
Author
Owner

@sandrodz commented on GitHub (Jul 19, 2023):

@NghiaTranUIT this worked:

image
<!-- gh-comment-id:1642231753 --> @sandrodz commented on GitHub (Jul 19, 2023): @NghiaTranUIT this worked: <img width="433" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/8479569/6bc36cc8-cf04-4a8e-b767-3b9ef329c48f">
Author
Owner

@sandrodz commented on GitHub (Jul 19, 2023):

@NghiaTranUIT this is generally a better way via docker-compose.proxyman.yml override:

version: '2'
services:
  php8.1-fpm-xdebug:
    environment:
      HTTP_PROXY: host.docker.internal:9090
      HTTPS_PROXY: host.docker.internal:9090
      http_proxy: host.docker.internal:9090
      https_proxy: host.docker.internal:9090

docker-compose -f docker-compose.yml -f docker-compose.php8.1-fpm-xdebug.yml -f docker-compose.proxyman.yml up -d

This is better and requires no docker daemon restart. When switching on/off.

<!-- gh-comment-id:1642279537 --> @sandrodz commented on GitHub (Jul 19, 2023): @NghiaTranUIT this is generally a better way via docker-compose.proxyman.yml override: ``` version: '2' services: php8.1-fpm-xdebug: environment: HTTP_PROXY: host.docker.internal:9090 HTTPS_PROXY: host.docker.internal:9090 http_proxy: host.docker.internal:9090 https_proxy: host.docker.internal:9090 ``` `docker-compose -f docker-compose.yml -f docker-compose.php8.1-fpm-xdebug.yml -f docker-compose.proxyman.yml up -d` This is better and requires no docker daemon restart. When switching on/off.
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 20, 2023):

Thanks @sandrodz I will update your suggestion to the Docker Documentation

<!-- gh-comment-id:1643487242 --> @NghiaTranUIT commented on GitHub (Jul 20, 2023): Thanks @sandrodz I will update your suggestion to the [Docker Documentation](https://docs.proxyman.io/debug-devices/docker)
Author
Owner

@sandrodz commented on GitHub (Jul 20, 2023):

@NghiaTranUIT but still, proxyman doesn't need anything to route non-ip based traffic from containers why ip is different? I think its better to resolve at the source. So we don't have to route traffic deliberatly.

This is a only gripe I've with proxyman with docker.
Otherwise I love this product (even purchasd license to support you guys).

<!-- gh-comment-id:1643544583 --> @sandrodz commented on GitHub (Jul 20, 2023): @NghiaTranUIT but still, proxyman doesn't need anything to route non-ip based traffic from containers why ip is different? I think its better to resolve at the source. So we don't have to route traffic deliberatly. This is a only gripe I've with proxyman with docker. Otherwise I love this product (even purchasd license to support you guys).
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 20, 2023):

Thanks. I will find a better solution to make it works out of the box.

<!-- gh-comment-id:1643568996 --> @NghiaTranUIT commented on GitHub (Jul 20, 2023): Thanks. I will find a better solution to make it works out of the box.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1705
No description provided.