Questions about happy path setup

133 views
Skip to first unread message

Vasanth Pappu

unread,
Dec 19, 2015, 4:31:28 PM12/19/15
to martianproxy-users
I've downloaded martian and installed it, and ran it like this:

```
$GOPATH/bin/proxy -v 5
2015/12/19 15:38:13 martian: proxy started on: [::]:8080
```

I posted the following JSON modifier files to http://martian.proxy/configure:
```
curl -x localhost:8080 \
         -X POST \
         -H "Content-Type: application/json" \
         -d @modifier.json \
            "http://martian.proxy/configure" -v
```

```
{
  "header.Modifier": {
    "scope": ["response"],
    "name": "Test-Header",
    "value": "true"
  }
}
```

```
{
  "url.Filter": {
    "scope": ["request", "response"],
    "host" : "example.com",
    "modifier" : {
      "status.Verifier": {
"scope" : ["response"],
"statusCode": 200
      }
    }
  }
}
```

The curl command output seemed to indicate that martian received the configurations:
```
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> User-Agent: curl/7.37.1
> Host: martian.proxy
> Accept: */*
> Proxy-Connection: Keep-Alive
> Content-Type: application/json
> Content-Length: 184
>
* upload completely sent off: 184 out of 184 bytes
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
<
```

Martian logs also seemed to indicate that the configuration was received, but I'm confused about the "EOF" message:
```
2015/12/19 16:09:26 INFO: martian: intercepted configuration request: http://martian.proxy/configure
2015/12/19 16:09:26 DEBUG: martian: waiting for request: [::1]:58932
2015/12/19 16:09:26 DEBUG: martian: connection closed prematurely: EOF
2015/12/19 16:09:26 DEBUG: martian: closing connection: [::1]:58932
```

I wanted to check that the verification modifier I sent was present, so I did
```
curl: (6) Could not resolve host: martian.proxy
```

How do I set up the host martian.proxy? I tried hitting localhost:8080/verify instead, but got this:
```
curl "localhost:8080/verify" -v
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /verify HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Warning: 199 "martian" "via: detected request loop, header contains martian" "Sat, 19 Dec 2015 16:28:05 GMT"
< Content-Length: 0
<
* Connection #0 to host localhost left intact
```

Is there a setup step I might be missing?

Vasanth



Adam Tanner

unread,
Dec 20, 2015, 6:14:38 PM12/20/15
to martianproxy-users
Hey Vasanth!

Thanks for checking out Martian!

It looks like you've got the proxy itself configured correctly. The important thing to remember is that the martian.proxy host is only configured when **sending configuration/verification requests through the proxy**. The proxy just intercepts that particular host.

If the request isn't sent through the proxy, cURL will try to resolve the domain and fail because martian.proxy doesn't actually exist. The second cURL command is missing the  "-x" flag that is used on the configuration request to set the proxy.

So something like `curl -x localhost:8080 http://martian.proxy/verify` should work. :)

We set it up this way so that users could easily configure the proxy through Selenium tests without having to find a way to pass the port around, but we've had a few different users run into issues understanding this so I'm looking at dropping the "martian.proxy" as default and configuring the proxy to respond to "localhost:{port}" by default so that it works the way most users expect it out of the box.

Either way, I definitely need to update the README to make this more clear. Thanks for pointing it out!

Let us know if you find anything else confusing, we're always looking for more feedback. :)

Adam
Reply all
Reply to author
Forward
0 new messages