New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location Header in /system/inputs REST response contains wrong value ('0.0.0.0') #1020

Closed
dfch opened this Issue Mar 3, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@dfch

dfch commented Mar 3, 2015

When issuing a POST /system/inputs to create a new input the server responds with HTTP 201 and a Location header. However the value of this header field does not contain the correct IP address of the actual location, but instead returns an 0.0.0.0 address: http://0.0.0.0:12900/system/inputs/54f49acee4b0688f19c107d5. This is in violation of RFC 2616 14.30 Location which states that the Location header is to refer to the actual location of the resource that was created in response to the request.

This behaviour was observed on a Graylog v1.0.0 inside the graylog2/allinone docker image on a CentOS 7.

Example Request

POST http://192.168.174.172:12900/system/inputs HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; de-CH) WindowsPowerShell/3.0
Content-Type: application/json
Authorization: Basic U2Nobml0dGVuZml0dGljaDpSb2NrWnp6
Host: 192.168.174.172:12900
Content-Length: 553

{
    "configuration":  {
      "tls_key_password":  "P@ssw0rd",
      "recv_buffer_size":  1048576,
      "max_message_size":  2097152,
      "bind_address":  "0.0.0.0",
      "port":  12201,
      "tls_enable":  false,
      "use_null_delimiter":  true
    },
    "title":  "myNewGlobalGelfTcpInput",
    "global":  true,
    "type":  "org.graylog2.inputs.gelf.tcp.GELFTCPInput"
}

Example Response

HTTP/1.1 201 Created
Location: http://0.0.0.0:12900/system/inputs/54f49acee4b0688f19c107d5
Content-Type: application/json
X-Runtime-Microseconds: 25602
Content-Length: 33

{"id":"54f49acee4b0688f19c107d5"}
@kroepke

This comment has been minimized.

Member

kroepke commented Mar 3, 2015

Investigate which host jersey's UriBuilder takes if none is specified.

@kroepke kroepke added the bug label Mar 3, 2015

@kroepke kroepke added this to the 1.0.1 milestone Mar 3, 2015

@dennisoelkers dennisoelkers self-assigned this Mar 4, 2015

@dennisoelkers

This comment has been minimized.

Member

dennisoelkers commented Mar 4, 2015

Thanks for reporting this. Can you please post the rest_listen_uri and rest_transport_uri (if defined) settings from your server's configuration file?

@dfch

This comment has been minimized.

dfch commented Mar 4, 2015

Hi Dennis, good hint! here are the values:

rest_listen_uri = http://0.0.0.0:12900/
#rest_transport_uri = http://192.168.1.1:12900/

However, I am using your official plain Docker image without any modification. So this is wrong out of the box. In my opinion this would have to be adjusted by the graylog-ctl reconfigure-* script.

@bernd

This comment has been minimized.

Member

bernd commented Mar 4, 2015

Setting rest_listen_uri to 0.0.0.0 is supported but the REST API should not generate Location headers with 0.0.0.0.

@dennisoelkers

This comment has been minimized.

Member

dennisoelkers commented Mar 4, 2015

Yeah, this is totally fine, but explains where the value in the location header is coming from. Will fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment