using a proxy server to access blue iris webservice

Troubleshooting, suggestions, and feedback pertaining to the UI3 Web interface
chefbennyj
Posts: 1
Joined: Sun Dec 09, 2018 12:54 am

using a proxy server to access blue iris webservice

Post by chefbennyj » Sun Dec 09, 2018 1:03 am

HI There!

I am using a proxy server (Caddy) to attempt to access my blue iris web server on my windows machine.

After giving the service a virtual endpoint of "/camera" and telling caddy that my proxy also would contain the "/camera" endpoint, there seems to be an issue with the web services UI loading Session Status (which fails), and Server status/ Cameras list which ready as busy.

I'm pretty sure this has to do with m,y proxy.

The UI also errors with:

"Error contacting Blue Iris server to check session status"

Response 404 error
Status: error
Error:
URL: /json

I guess the JSON endpoint isn't accessible.

I should also mention that the default port "81" is open on my router.

I have not enabled WAN access through the router because Caddy is taking care of any HTTPS encrypted communication between the domain and the proxies behind it.


I should also mention that I have to disable "Advanced: use secure session key login", because there is an error when enabled in the UI saying:

"Uncaught referenceError: $ is not defined at "https://censored_hostname/camera..... etc"

Any help would be great! Thanks!

Ben

User avatar
NobleKangaroo
Posts: 2
Joined: Mon Dec 17, 2018 5:05 pm

Re: using a proxy server to access blue iris webservice

Post by NobleKangaroo » Mon Dec 17, 2018 5:58 pm

New here, similar use case, found this post and strangely enough I am having the same issue. Routed through Apache with mod_proxy but the JSON XMLHTTPRequest is failing the same.


"Web server" page in BI settings:
Image


Apache settings (working for several other apps I route):
Image


Plain path, ignoring "Virtual" setting in BI's "Web server" settings:
Image


"Virtual" path, respecting "Virtual" setting:
Image


I've tried changing the Apache settings in various ways (adding another entry for /cam/json; editing jsonBaseUrl in C:\Program Files\BIlue Iris 4\www\applet\loginScripts.js; various other fixed found while doing some Google searches) - all have failed in properly proxying the XHR to /json. Looks like for some reason the XHRs just aren't being redirected properly. Strange thing is even in the Apache logs, the requests to /json and /cam/json are throwing a 404...

Image


Totally stumped; wish I could get this working.

Any help would be great!

killer2239
Posts: 6
Joined: Thu Jan 17, 2019 4:23 pm

Re: using a proxy server to access blue iris webservice

Post by killer2239 » Thu Jan 17, 2019 4:25 pm

Looks like I am not the only one having this issue then. Here is what I posted somewhere else looking for help:

I have the web interface working fine for years now with no issue. I wanted to add the web interface to work with my nginx server. I changed the virtual directory to /bi , to match the domain.com/bi url. I have tried multiple different proxy pass configurations I could find from various people with different settings that all have it working with no issue. I have LAN interface to not require authentication. If I go to the new bi path of domain.com:port/bi using the blueiris port I have forwarding to the BI web it still works too. However, I get the web interface to start loading on domain.com/bi , but the 3 line down fails where it says

Checking Session Status... Fail

Then in the bottom right the red box says:
Error contacting blue iris server to check session status.
Status: error
Error: URL: /json

When I view the connections in blue iris, it shows the Anonymous connection with my nginx servers local IP trying to connect. I have tried this in both Chrome and Edge to make sure it wasn't just Chrome. So something is not passing or working with the session checking.

I enabled login auth for all connections because it seems session related, and I got an error when it tries to load the login page. Its doing com/bilogin.htm?page=%2F , it is leaving out the / between bi and login. I am running the latest BlueIris, so I think it might be an issue with the syntax somewhere with the logins / sessions for it. Any ideas on a file to mod, or is this a bug the dev needs to fix?

HeneryH
Posts: 335
Joined: Fri Mar 16, 2018 1:38 pm

Re: using a proxy server to access blue iris webservice

Post by HeneryH » Thu Jan 17, 2019 4:47 pm

I use a proxy but not the one you are using so I can't help.

My Nginx on Linux proxy (running as a VM on the BI machine) works perfectly and has the ability to automatically update its Let's Encrypt signed certificates.

Sorry you are having trouble but the base case of using a proxy server is sound.

killer2239
Posts: 6
Joined: Thu Jan 17, 2019 4:23 pm

Re: using a proxy server to access blue iris webservice

Post by killer2239 » Thu Jan 17, 2019 4:53 pm

HeneryH wrote:
Thu Jan 17, 2019 4:47 pm
I use a proxy but not the one you are using so I can't help.

My Nginx on Linux proxy (running as a VM on the BI machine) works perfectly and has the ability to automatically update its Let's Encrypt signed certificates.

Sorry you are having trouble but the base case of using a proxy server is sound.
Is your redirect using the root of your domain or is it using a domain.com/blueiris setup?

HeneryH
Posts: 335
Joined: Fri Mar 16, 2018 1:38 pm

Re: using a proxy server to access blue iris webservice

Post by HeneryH » Thu Jan 17, 2019 4:56 pm

killer, I see you are using nginx too.

I didn't mess with the BI web settings at all. Just leave them alone with the standard settings on port 81.

Then set up nginx to proxy-pass to the BI machine and port.

HeneryH
Posts: 335
Joined: Fri Mar 16, 2018 1:38 pm

Re: using a proxy server to access blue iris webservice

Post by HeneryH » Thu Jan 17, 2019 4:57 pm

I'll post my nginx config here in a few mins.

HeneryH
Posts: 335
Joined: Fri Mar 16, 2018 1:38 pm

Re: using a proxy server to access blue iris webservice

Post by HeneryH » Thu Jan 17, 2019 5:07 pm

Note that my nginx vm is set to get its own unique ip address rather than share its host IP. I then add that proxy server to my port-forwarding settings in my router.

Code: Select all

        location / {
            proxy_pass http://192.168.1.233:81;   (note 233 is my BI)
            }
First I configured without SSL certs having my proxy accept incoming 80 and proxy pass them to BI on 81. Then I followed-up with the Let's Encrypt steps using cert-bot to create and load the certs and to redirect http to https automatically on incoming requests.

killer2239
Posts: 6
Joined: Thu Jan 17, 2019 4:23 pm

Re: using a proxy server to access blue iris webservice

Post by killer2239 » Thu Jan 17, 2019 5:13 pm

HeneryH wrote:
Thu Jan 17, 2019 4:57 pm
I'll post my nginx config here in a few mins.
I don't think you need to. I just did a test to confirm my theory. If you use the root of your domain, like location / , then BlueIris loads fine. If you don't want to use the root and use a folder like domain.com/bi , it doesn't work. Even changing the virtual environment in BlueIris to /bi. Something where it does the session verification, it not putting the / after the folder name so it wants to load /biloginxxxx instead of /bi/login.xxxx . So its a bug within blue iris, might be a simple fix in 1 file to add a / or something. That is whats causing the issues mentioned above in this thread, so hopefully they fix it soon.

killer2239
Posts: 6
Joined: Thu Jan 17, 2019 4:23 pm

Re: using a proxy server to access blue iris webservice

Post by killer2239 » Thu Jan 17, 2019 6:25 pm

I finally figured it out after trial and error using some nginx redirect stuff that "monit" has to use to work. So here is how I got it working with nginx, not sure if it will help the OP but hopefully it helps anyone else in the future not wanting the root / to be their BlueIris setup.

In the settings of BlueIris under webserver:
virtual is: /bi/ (You can change bi to whatever you want)

Then for nginx reverse config assuming your port is 81 and BlueIrisServerIP is 192.168.1.220

Code: Select all

location /bi/ {
	rewrite ^/bi/(.*) /$1  break;
	proxy_ignore_client_abort on;
	proxy_pass http://192.168.1.220:81;
	proxy_redirect http://192.168.1.220:81 /bi;
}

Post Reply