Nginx proxy setup on folder - resolved

Ok so I got IOTAWatt to work when on the root of the of my domain eg. www.test.co.za.

But I would like to run it off a folder eg. www.test.co.za/IOTAWatt/.

When I configure this I get the following error when configuring it on a folder :
Not found: GET, URI: /iotawatt/

Hope someone can share an nginx config file that uses a folder redirect.

Thanks

Can you post the NGINX location that you are using?

image

Not real proficient at NGINX but I think I understand your problem. IoTaWatt is receiving a URL:

http://192.168.0.136/iotawatt/

IoTaWatt is responding as you posted above. It does not recognize the URI /iotawatt/.

If you look into how proxy_pass works, if you don’t specify a URI as part of your proxy_pass, the URI ("/iotawatt/") of the original request is appended to the proxy_pass hostname.

If you specify a URI ("/") in the proxy_pass URL, it will replace the portion of the original request URI that matches the location.

So bottom line, try changing your proxy_pass to:

proxy_pass http://192.168.0.136/;

Thanks it worked now. Learned something new on nginx setup.

Makes me understand some of the other nginx I have setup at the moment.

Sorry was too quick and didn’t really check that everything was working.

So just noticed this error :man_facepalming:

Also this error when running the graphs:

I am sure I forgot to update the base url setting someplace but cannot find it.

Thanks Rudolph

I was able to recreate this. It’s an interesting issue. I was able to get past the configuration not found issue by changing the request URI. It would appear that the changed URI is the preferred form as it passes transparently through the proxy. However, I’ll need to insure it has no unexpected consequences elsewhere and also there are related issues with the file manager and graph. I would like to resolve these but it will take some time.

In the meantime, you might consider using port forwarding to gain access from the outside. I’ll post to this thread when I have an intermediate solution (basically new versions of several htm and js files that you would need to install. If that works out, I’ll integrate into a release.

Thanks.

No rush and will run it as root or port forwarding for now.

Let me know if you need someone to test. Happy to play alpha tester.

Thanks Rudolph

Here’s a first pass at modifications to support proxy_pass. Download these three files and upload to your IoTaWatt. They should also work fine in local mode without the proxy. Please report ANY abnormalities.

edit.htm (24.5 KB)
graph.js (35.6 KB)
index.htm (118.2 KB)

strange error when trying to download graph2.js

After some basic testing the basic status en start page working 100%

@overeasy Sorry to be a pain but have you been able to see why I cannot download the graph2.js that you made the changes to. I loaded all the other files and they work but haven’t been able to download the graph2 file so still getting errors on that.

Thanks Rudolph

Hello @rterblanche,

I have not been able to determine what is going on there. I just tried to upload the file again with the same results (I know).

But I’ve been working on resolving some other issues with this change, with no success. It is a fairly radical change to the way the root of the filesystem is referenced, and I’ve found some problems that I am unable to work around.

I’m putting together the next release and had decided to back this out as too risky. Given that there is another method to access different units (use different ports). There may be a purely NGINX solution to this, but I’m just not that well versed in NGINX to explore it. If you do and find a solution there, please get back with the details.

Sorry this didn’t work out.

No problem.

Have it working in a different way. Just wanted to test for you. But thanks for trying.

Will stick to just running it on a different port.

maybe just to add. most of the other systems I have seen you need to configure your folder in a parameter to be able for the systems to work. none are able to work on the same code base without the config parameter.

That’s consistent with the problems I encountered.