# Graylog API-Browser Broken after change to https

**URL:** https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630
**Category:** Graylog Central (peer support)
**Created:** [July 3, 2017, 7:14am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630 "2017-07-03T07:14:55Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 7:14am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/1 "2017-07-03T07:14:55Z")

</div>

After changing the Graylog API to https, the api-browser is dead, it only shows me a login field with no css loaded.

The console outputs me:

```
Uncaught ReferenceError: $ is not defined
at api-browser:30
(anonymous) @ api-browser:30
api-browser:6 Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://syslog.xyz.local/api-browser/css/highlight.default.css".
api-browser:5 Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://syslog.xyz.local/api-browser/css/fonts.css".
api-browser:7 Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://syslog.xyz.local/api-browser/css/screen.css".

```

Graylog config:

```
rest_listen_uri = http://127.0.0.1:12900/
rest_transport_uri = https://syslog.xyz.local/api/
web_listen_uri = http://127.0.0.1:9000/

```

Nginx config:

```
http {
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log main;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
      listen 80;
      server_name syslog.xyz.local;

      if ($host = 'graylog.xyz.local' ){
          rewrite ^/(.*)$ https://syslog.xyz.local permanent;
      }
      return 301 https://syslog.xyz.local$request_uri;
      error_page 502 /502.html;
      location /502.html {
        internal;
      }
    }
    
    server {
      listen 443 ssl;
      server_name syslog.xyz.local;

      if ($host = 'graylog.xyz.local' ){
          rewrite ^/(.*)$ https://syslog.xyz.local permanent;
      }

      ssl on;
      ssl_dhparam /etc/nginx/ca/dhparams.pem;
      ssl_certificate /etc/nginx/ca/graylog.crt;
      ssl_certificate_key /etc/nginx/ca/graylog.key;
      ssl_session_timeout 5m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES12$;
      ssl_prefer_server_ciphers on;

  location /
    {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Graylog-Server-URL https://syslog.xyz.local/api;
        proxy_pass http://127.0.0.1:9000;
    }

      location /api/ {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:12900/;
      }

      error_page 502 /502.html;
      
      location /502.html {
        internal;
      }
    }
    }
```

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 7:33am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/2 "2017-07-03T07:33:41Z")

</div>

Which version of Graylog are you using?

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 7:43am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/3 "2017-07-03T07:43:29Z")

</div>

Oh sorry i missed that:

```
Graylog 2.2.0+d9681cb on syslog.xyz.local (Oracle Corporation 1.8.0_131 on Linux 3.10.0-514.16.1.el7.x86_64)

```

And i want to wait with the Upgrade to 2.3 bcs of the huge ES upgrade.

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 8:16am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/4 "2017-07-03T08:16:23Z")

</div>

What’s the URI you’re using to access the API Browser (Swagger UI)?

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 8:30am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/5 "2017-07-03T08:30:21Z")

</div>

I use the Button in the Graylog GUI next to the Node information.

It gives me:

```
https://syslog.xyz.local/api/api-browser
```

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 8:35am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/6 "2017-07-03T08:35:33Z")

</div>

Graylog 2.2.0 _should_ use the path component of `rest_transport_uri` to build URIs in Swagger:

**EDIT:** Wrong, Graylog 2.2.0 is using the path component of **`rest_listen_uri`** to build URIs in Swagger

> <https://github.com/Graylog2/graylog2-server/blob/2.2.0/graylog2-server/src/main/java/org/graylog2/shared/rest/resources/documentation/DocumentationBrowserResource.java#L54>

  

> <https://github.com/Graylog2/graylog2-server/blob/2.2.0/graylog2-server/src/main/resources/swagger/index.html.template#L29>

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 8:38am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/7 "2017-07-03T08:38:37Z")

</div>

So, my graylog config is not correct, or my nginx config is not correct? I dont get it. 😥

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 8:43am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/8 "2017-07-03T08:43:59Z")

</div>

Argh, my fault. And it’s even saying it in the code…

Graylog 2.2.0 is using the path component of the `rest_listen_uri` setting, which is empty (or `/`) in your case. Try setting `rest_listen_uri = http://0.0.0.0:12900/api` (also [see the default in Graylog 2.2.0](https://github.com/Graylog2/graylog2-server/blob/2.2.0/misc/graylog.conf#L79-L81)).

Is there any reason you’re _not_ using the default setting for `rest_listen_uri` (especially the port)?

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 8:46am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/9 "2017-07-03T08:46:29Z")

</div>

rest\_listen\_uri = [http://0.0.0.0:12900/api](http://0.0.0.0:12900/api) was my old configuration, I prefer to use only https for the api. So rest\_listen\_uri = [http://0.0.0.0:12900/api](http://0.0.0.0:12900/api) would expose it without TLS.

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 9:02am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/10 "2017-07-03T09:02:31Z")

</div>

You’re using a reverse proxy for terminating the HTTPS endpoint, so the schema used in `rest_listen_uri` doesn’t matter here.

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 10:00am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/11 "2017-07-03T10:00:28Z")

</div>

I see, so when i change it to rest\_listen\_uri = [http://0.0.0.0:12900/api](http://0.0.0.0:12900/api) Graylog GUI doesnt work anymore i get: We are experiencing problems connecting to the Graylog server running on [https://syslog.xyz.local/api](https://syslog.xyz.local/api). Please verify that the server is healthy and working correctly.

---

<div class="post-metadata">

### Author: ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)
#### Post date: [July 3, 2017, 10:19am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/12 "2017-07-03T10:19:42Z")

</div>

You have to adapt your nginx configuration to the changed URI of the Graylog REST API.

FWIW, using the same port for the Graylog REST API and the web interface, and using the nginx configuration from the documentation at [http://docs.graylog.org/en/2.2/pages/configuration/web\_interface.html#nginx](http://docs.graylog.org/en/2.2/pages/configuration/web_interface.html#nginx) would save you some hassle.

---

<div class="post-metadata">

### Author: ![gruselglatz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gruselglatz/32/4126_2.png) [@gruselglatz](https://community.graylog.org/u/gruselglatz)
#### Post date: [July 3, 2017, 10:36am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/13 "2017-07-03T10:36:53Z")

</div>

Ok thanks, i changed it, so its the same as described in

> REST API and Web Interface on one port (using HTTPS/SSL):

But I get the same ERROR as in the Post above.

EDIT: Changing the rest\_listen\_uri to rest\_listen\_uri = **[http://127.0.0.1:9000/api/](http://127.0.0.1:9000/api/)** solved it.

---

<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: [July 17, 2017, 10:37am UTC](https://community.graylog.org/t/graylog-api-browser-broken-after-change-to-https/1630/14 "2017-07-17T10:37:19Z")

</div>

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