# API Browser Not Working - Via Nginx and/or Direct Node

**URL:** <https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582>\
**Category:** Graylog Central (peer support)\
**Created:** [October 31, 2019, 11:00pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582 "2019-10-31T23:00:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![csshaun](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@csshaun](https://community.graylog.org/u/csshaun)\
**Post date:** [October 31, 2019, 11:00pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/1 "2019-10-31T23:00:56Z")

</div>

Hi All;

I’ve installed GreyLog and I’ve managed to get streams and inputs working and its great. I would now like to use the API to get some data out of Graylog for dashboards etc.

I have installed Graylog at [http://graylog.cashstop.com.au](http://graylog.cashstop.com.au) which resolves to an internal address inside our AWS.

_( First I tried to setup https however I got an error because I was using a CA cert which (by design) didn’t contain the local node IP so the node could not communicate with itself, hence I went back to http.)_

I have reverted the configuration back to http and when I view [https://graylog.cashstop.com.au/api/api-browser](https://graylog.cashstop.com.au/api/api-browser) I am shown a list of all the methods. When I click on a the [Show/Hide] to display the method details nothing happens. On viewing the Chrome Console I can see a network request is made however I get a 500 response. When I view the link thats trying to load i get the below Internal Server Error.

```
Reason
java.net.URISyntaxException: Illegal character in path at index 62: http://graylog.cashstop.com.au:80/api/api-docs/system/metrics/{metricName}/history

Stacktrace
java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in path at index 62: http://graylog.cashstop.com.au:80/api/api-docs/system/metrics/{metricName}/history
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.getRequestUri(GrizzlyHttpContainer.java:491)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:366)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224)
	at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:181)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.URISyntaxException: Illegal character in path at index 62: http://graylog.cashstop.com.au:80/api/api-docs/system/metrics/{metricName}/history
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parseHierarchical(URI.java:3105)
	at java.net.URI$Parser.parse(URI.java:3053)
	at java.net.URI.<init>(URI.java:588)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.getRequestUri(GrizzlyHttpContainer.java:489)
	... 6 more

```

I haven’t coded Java in years so I wouldn’t know where to start to look at the issue.

Any help would be appreciated.

Thanks

Shaun

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 4, 2019, 8:30am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/2 "2019-11-04T08:30:37Z")

</div>

check your configuration file - I guess that you have copy&pasted a non valid character into that when you have edited your configuration.

---

<div class="post-metadata">

**Author:** ![csshaun](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@csshaun](https://community.graylog.org/u/csshaun)\
**Post date:** [November 4, 2019, 10:23am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/3 "2019-11-04T10:23:10Z")

</div>

Jan

Thanks for your reply. I doubled checked the configuration and all looks right. I also didn’t copy and paste when I edited it. It was all done in vim.

All the other redirection and URLs are working correctly it’s just the API Browser that’s not working.

Really loving greylog and I’d love to get this sorted. Only other idea I have is this was an appliance I tried to upgrade. I may be better with migrating the data some how and starting a fresh install.

Thanks

Shaun

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [November 5, 2019, 9:07am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/4 "2019-11-05T09:07:04Z")

</div>

I have same problem in 3.1.2 version (OVA appliance).

If I configure http\_publish\_uri (or http\_external\_uri) to real http/https address, for example http\_publish\_uri = [http://10.0.0.2/](http://10.0.0.2/) api browser opens, but when I click on [Show/Hide] nothing happened.

I tried Firefox 70, and I also see lot of 500 error messages in Inspector. Probably graylog API browser has problem to work via reverse proxy like Nginx.

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 6, 2019, 6:47pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/5 "2019-11-06T18:47:49Z")

</div>

he @shoothub  
I actually have exact that in my lab configured without having problems. How did you access the api-browser?

I use https://my\_graylog\_via\_proxy/api/api-browser (and type that in direct, not by clicking on any button)

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [November 7, 2019, 7:58am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/6 "2019-11-07T07:58:11Z")

</div>

Hello jan,  
I have no problem to open api-browser page, but I couldn’t expand sections, so when I click on detail in row for example _ **Cluster : System information of all nodes in the cluster** _ and want to expand section clicking on button **Show/Hide** or **List Operations** , nothing happened.

If I opened Inspector in Firefox, section Network, I can see a lot of (33) request with response code 500, check screenshot:

 ![graylog-api-browser-500](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/3/32c1d25e3ef99a355d358e03c8e3cf92676f1e41.png)

I use Firefox 70 x86\_64 on Fedora 31, I also tried Chromium 77.

But if I comment line http\_publish\_uri or change http\_publish\_uri to [http://10.44.0.20:9000/](http://10.44.0.20:9000/) api browser work as expected, I can expand sections and insert some inputs to api browser. Firefox inspector shows all request with response code 200.

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 7, 2019, 3:03pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/7 "2019-11-07T15:03:58Z")

</div>

the `http_publish_uri` needs to be the unique reachable ip for each Graylog node. But `http_external_uri`shoud be the loadbalancer … how do you have that configured?

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [November 7, 2019, 3:09pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/8 "2019-11-07T15:09:58Z")

</div>

I tried all posible combinations:

1. First attempt: http\_publish\_uri = [http://10.44.0.20/](http://10.44.0.20/)
2. Second attempt: http\_publish\_uri = [http://10.44.0.20/](http://10.44.0.20/) and http\_external\_uri = [http://10.44.0.20/](http://10.44.0.20/)
3. Third attempt: http\_external\_uri = [http://10.44.0.20/](http://10.44.0.20/)

None of these worked, I have only one node (one OVA instance).

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 7, 2019, 3:35pm UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/9 "2019-11-07T15:35:10Z")

</div>

ok, I assume you have Graylog running on 10.44.0.20 on port 9000 and having nginx running on port 80 on the same ip.

the `http_settings_*` should be the following:

```auto
# assuming you want to listen to all possible devices with Graylog
http_bind_adress = 0.0.0.0:9000

# this is how the node can reach itself
http_publish_uri = http://10.44.0.20:9000

# this is how your browser can reach graylog
http_external_uri = http://10.44.0.20

```

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [November 8, 2019, 7:01am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/10 "2019-11-08T07:01:00Z")

</div>

Thanks Jan, It works, but I think it is a same state as I leave default settings (commented 2 parameters: http\_publish\_uri, http\_external\_uri).

So I still need to run API browser on port 9000 to work. Is there a way to run api-browser through port 80, so I wouldn’t open port 9000 on my firewall? I guess no…

But REST API works ok on port 80, I can run this without problems:  
curl -u admin:password -H ‘Accept: application/json’ -X GET ‘[http://10.44.0.20/api/cluster?pretty=true](http://10.44.0.20/api/cluster?pretty=true)’

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 11, 2019, 8:56am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/11 "2019-11-11T08:56:17Z")

</div>

> So I still need to run API browser on port 9000 to work. Is there a way to run api-browser through port 80, so I wouldn’t open port 9000 on my firewall? I guess no…

I do not have that problem - what kind of settings did you use in the NGINX proxy? Maybe some of that prevent that the system is working proper.

---

<div class="post-metadata">

**Author:** ![shoothub](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/shoothub/32/6412_2.png) [@shoothub](https://community.graylog.org/u/shoothub)\
**Post date:** [November 11, 2019, 9:08am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/12 "2019-11-11T09:08:14Z")

</div>

I use default OVA nginx config, I didn’t change nothing in it:  
sudo vim /etc/nginx/sites-available/default

> server {  
> listen 80;  
> location / {  
> proxy\_pass [http://127.0.0.1:9000/](http://127.0.0.1:9000/);  
> proxy\_http\_version 1.1;  
> proxy\_set\_header Host $host;  
> proxy\_set\_header X-Real-IP $remote\_addr;  
> proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
> proxy\_pass\_request\_headers on;  
> proxy\_connect\_timeout 150;  
> proxy\_send\_timeout 100;  
> proxy\_read\_timeout 100;  
> proxy\_buffering off;  
> client\_max\_body\_size 8m;  
> client\_body\_buffer\_size 128k;  
> expires off;  
> }  
> error\_page 502 /502.html;  
> location /502.html {  
> internal;  
> }  
> }

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [November 25, 2019, 9:08am UTC](https://community.graylog.org/t/api-browser-not-working-via-nginx-and-or-direct-node/12582/13 "2019-11-25T09:08:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
