Skip to main content
1-Visitor
September 21, 2015
Question

URL Masking for ThingWorx REST Service

  • September 21, 2015
  • 2 replies
  • 9161 views

As per my understanding, ThingWorx services can be exposed as REST, but URI would be /Thing/ThingName/Services/ServiceName.

Exposing services in this way could expose business data/entities as well.

My question is that, can we MASK thingworx service URL in a custom or a REST way i.e. /resources ?

2 replies

1-Visitor
September 21, 2015

I actually tried this one time with a URL Rewrite called 'Tuckey' but I couldn't make it work, so it may not be possible. But that is what I would recommend. 'Theoretically' it could work, but when I tried it, I couldn't make it work, although I didn't go very deep.

esirohi1-VisitorAuthor
1-Visitor
September 21, 2015

Thanks for replying.

As you mentioned that you tried URL Rewriting, what error/issues you encountered? I will also try out at my end.

I think, the changes can be made in domain setup (probably CNAME or URL Forwarding/Redirection) which can redirect a domain to another URL.

1-Visitor
September 21, 2015

It's been a rather long time so I don't remember.

7-Bedrock
September 29, 2015

This simple nginx configuration works for me:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

          location / {
               proxy_pass       http://localhost:8080;
               proxy_set_header Host      $host;
               proxy_set_header X-Real-IP $remote_addr;
          }

          location /service {
               proxy_pass http://localhost:8080/Thingworx/Things/Neuron/ServiceDefinitions/GetConfigurationTables;
               proxy_set_header Host $host;
               proxy_set_header X-Real-IP $remote_addr;
          }
          
     }
}

It exposes "GetConfigurationTables" service as http://localhost/service, while forwarding the rest of the requests to the port 8080.

5-Regular Member
December 2, 2016

Does the reverse proxy approach still work with a websocket connection from the edge? I was under the impression that reverse proxy broke websockets.

7-Bedrock
December 6, 2016

Nginx supports websockets in reverse proxy mode under certain circumstances, needs to be tested with EDGE SDK: WebSocket proxying