Using nginx as a reverse proxy with thinger.io


#1

Hi there.

I’m using a nginx to act as a reverse proxy through which thinger will talk to the outside world. While I do manage to get to the login page of thinger with my setup, when trying to login/register user, an HTTP request is made towards /oauth/token which is looked up in nginx’s default directory. Thus I get an error.

Any thoughts on how I should configure nginx.conf to play well with thinger? Edit: Or is there a thinger configuration that needed? (ping @alvarolb)

Thank you in advance.

nginx.conf excerpt:
server {
listen 8102; ## HTTP

<other, omitted contents>

location /iotPlatformConsole/ {

  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_set_header        X-Forwarded-Proto $scheme;

      proxy_pass  http://localhost:8085/;
    }

thinger config.json excerpt:
“http_server” : {
“address” : “0.0.0.0”,
“port” : “8085”,
“ssl_port” : “44301”,
“hosts” : [
{
“host”: “*”,
“type”: “rest”,
“cors”: {
“enabled” : true
},
“web_fallback” : {
“enabled” : true,
“root”: “${SNAP}/console”
}
}

nginx access.log:
<client IP address> - - [13/Sep/2018:11:23:52 +0300] "POST /oauth/token HTTP/1.1" 404 178 "http://<server IP address>:8102/iotPlatformConsole/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0" "-"

nginx error.log:
2018/09/13 11:23:48 [warn] 24653#24653: *4 an upstream response is buffered to a temporary file /var/lib/nginx/proxy/2/00/0000000002 while reading upstream, client: , server: demo, request: “GET /iotPlatformConsole/js/app-d53608f648.js HTTP/1.1”, upstream: “http://127.0.0.1:8085/js/app-d53608f648.js”, host: “:8102”, referrer: “http://:8102/iotPlatformConsole/”
2018/09/13 11:23:52 [error] 24653#24653: *4 open() “/usr/share/nginx/html/oauth/token” failed (2: No such file or directory), client: , server: demo, request: “POST /oauth/token HTTP/1.1”, host: “:8102”, referrer: “http://:8102/iotPlatformConsole/”
2018/09/1