Closed alia5gar closed 1 year ago
Here is the snippet from docker compose file
proxy_server:
image: mockserver/mockserver
ports:
- 7000:1080
environment:
- MOCKSERVER_LOG_LEVEL=DEBUG
proxy_client:
build:
context: ./node-proxy
depends_on:
proxy_server:
condition: service_started
environment:
- SERVER_URL=https://proxy_server
- SERVER_PORT=1080
The issue seems to persists even if the mockserver is running as a stand alone container, and when the client tries to connect to it via localhost, In this case the issue can be resolved with the --net=host flag in the docker run command
I also wrote a small http get call at the start of the client to check the connection to the server But that too gives the same CONNECTION REFUSED Error
We can close this issue it turns out the problem was in the client, and not in the server we don't need to pass the complete URL of the server we just need to pass the domain, without the protocol
Describe the issue We have a docker compose file, with a mockserver image as the server, and a client created in nodejs When the mockserver client tries to connect to the the mock server, it gives connection refused error
MockServer version Using the latest image of mockserver on docker hub (at the time of posting the comment)
// payment service mockserverClient(process.env.SERVER_URL, process.env.SERVER_PORT) .mockAnyResponse( { httpRequest: { method: 'POST', path: "/v1/webhook", }, httpForward: { host: '0.0.0.0', port: 8002 }, times: { unlimited: true } } ) .then( () => {}, (error) => { console.log(error) } );
`2023-02-26 06:42:53 5.15.0 INFO using environment variables:
[ SERVER_PORT=1080, MOCKSERVER_LOG_LEVEL=DEBUG ]
and system properties:
[ mockserver.propertyFile=/config/mockserver.properties ]
and command line options:
[
]
2023-02-26 06:42:54 5.15.0 FINE logger level is DEBUG, change using:
'mockserver.logLevel' property value in 'mockserver.properties' 2023-02-26 06:42:54 5.15.0 INFO 1080 started on port: 1080 2023-02-26 06:44:50 5.15.0 INFO using environment variables:
[ SERVER_PORT=1080, MOCKSERVER_LOG_LEVEL=DEBUG ]
and system properties:
[ mockserver.propertyFile=/config/mockserver.properties ]
and command line options:
[
]
2023-02-26 06:44:51 5.15.0 FINE logger level is DEBUG, change using:
'mockserver.logLevel' property value in 'mockserver.properties' 2023-02-26 06:44:51 5.15.0 INFO 1080 started on port: 1080 2023-02-26 06:46:37 5.15.0 INFO using environment variables:
[ SERVER_PORT=1080, MOCKSERVER_LOG_LEVEL=DEBUG ]
and system properties:
[ mockserver.propertyFile=/config/mockserver.properties ]
and command line options:
[
]
2023-02-26 06:46:38 5.15.0 FINE logger level is DEBUG, change using: