ukdtom / WebTools.bundle

WebTools is a collection of tools for Plex Media Server. Like the Unsupported AppStore (UAS)
https://forums.plex.tv/discussion/288191
Mozilla Public License 2.0
1.3k stars 170 forks source link

Github Release Not Found #478

Closed mrtumnus closed 6 years ago

mrtumnus commented 6 years ago

Environment

Error shown

Text of the error, to make this issue searchable for others: Error occurred! WebTools Technical Info: Url: api/v3/git/getReleaseInfo/url/https%3A%2F%2Fgithub.com%2Fukdtom%2FWebTools.bundle/version/latest Location: Core Error: var checkIsNewVersionAvailable - Not Found The requested URL /tools/api/v3/git/getReleaseInfo/url/https://github.com/ukdtom/WebTools.bundle/version/latest was not found on this server.

Steps to reproduce

  1. Login to WebTools

Expected behaviour

  1. WebTools home page appears

Actual behaviour

  1. WebTools home page appears, with a popup displayed

Additional Info

I am using an Apache reverse proxy to run WebTools via https://plex.mydomain.com/tools/. Perhaps this is messing up the URL for checking new releases.

Checklist

trumpy81 commented 6 years ago

I would say your conclusion is correct. Your reverse proxy is messing up the URL's and not allowing WebTools to connect.

Also, your Plex logs are irrelevant as they do not contain the WebTools logs. You need to gather the WebTools logs from the ...Plex Media Server/Logs/PMS Plugin Logs folder manually.

mrtumnus commented 6 years ago

Also, your Plex logs are irrelevant as they do not contain the WebTools logs. You need to gather the WebTools logs from the ...Plex Media Server/Logs/PMS Plugin Logs folder manually.

I did gather them manually. Check the zip again, it contains the PMS Plugin Logs folder. Maybe I confused you because I included Plex logs as well.

ukdtom commented 6 years ago

Proxy issue!

From the log:

The requested URL /tools/api/v3/git/getReleaseInfo/url/https://github.com/ukdtom/WebTools.bundle/version/latest was not found on this server.

Normally, it should be like: `

2018-01-15 20:46:44,747 (7f59fa56f700) : DEBUG (gitV3:1038) - Function to call is: GETRELEASEINFO with params: ['url', 'https%3A%2F%2Fgithub.com%2Fukdtom%2FWebTools.bundle', 'version', 'latest']

94 | 2018-01-15 20:46:44,748 (7f59fa56f700) : INFO (gitV3:915) - Starting getReleaseInfo

95 | 2018-01-15 20:46:44,750 (7f59fa56f700) : DEBUG (gitV3:951) - Getting release info from url: https://api.github.com/repos/ukdtom/WebTools.bundle/releases/latest

96 | 2018-01-15 20:46:44,794 (7f59fa56f700) : DEBUG (networking:166) - Requesting 'https://api.github.com/repos/ukdtom/WebTools.bundle/releases/latest'

97 | 2018-01-15 20:46:45,437 (7f59fa56f700) : DEBUG (gitV3:956) - Got the following from github

`

mrtumnus commented 6 years ago

Hmm...do you think my proxy configuration is the culprit, or is the getReleaseInfo method not handling the proxy URL prefix?

Here's my proxy/rewrite config for Plex & WebTools:

ProxyPass /: ws://localhost:32400/:
ProxyPassReverse /: ws://localhost:32400/:

ProxyPass /: wss://localhost:32400/:
ProxyPassReverse /: wss://localhost:32400/:

ProxyPass /tools http://localhost:33400/tools
ProxyPassReverse /tools http://localhost:33400/tools

ProxyPass / http://localhost:32400/
ProxyPassReverse / http://localhost:32400/

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{REQUEST_URI} !^/tools
RewriteCond %{HTTP:X-Plex-Device} ^$
RewriteCond %{QUERY_STRING} (^|&)X-Plex-Device=(&|$) [OR]
RewriteCond %{QUERY_STRING} !(^|&)X-Plex-Device=
RewriteRule ^/$ /web/$1 [R,L]
ukdtom commented 6 years ago

What's up with the /tools thing?

Read this instead:

https://github.com/ukdtom/WebTools.bundle/wiki/Configure

mrtumnus commented 6 years ago

/tools is the base URL for WebTools. Its also what apache uses for the proxy.

On Tue, Jan 23, 2018, 3:50 PM Tommy Mikkelsen notifications@github.com wrote:

What's up with the /tools thing?

Read this instead:

https://github.com/ukdtom/WebTools.bundle/wiki/Configure

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ukdtom/WebTools.bundle/issues/478#issuecomment-359925938, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqF1lW0m5XKxL9n4Sa61uYxa8jm7N3rks5tNkYigaJpZM4Rp8L4 .

ukdtom commented 6 years ago

Try and disable your rewriteengine, and then type the correct url's...

If that works, fix your setup, and nope...no idea about how, but others made it work without a rewrite engine! And when said....

Not a WebTools issue, so very tempted to close this, since not an Apache ModProxy dude!

And do assume, that you configured WebTools with a baseurl as /tools ?

mrtumnus commented 6 years ago

The rewrite is for redirecting plex.mydomain.com to plex.my domain.com/web/, so it lands on the main home page.

Yes, I have the WebTools baseurl set to /tools.

Everything else works properly, I just get this error message after login.

I'll try disabling the rewrite and see what happens.

On Tue, Jan 23, 2018, 5:43 PM Tommy Mikkelsen notifications@github.com wrote:

Try and disable your rewriteengine, and then type the correct url's...

If that works, fix your setup, and nope...no idea about how, but others made it work without a rewrite engine! And when said....

Not a WebTools issue, so very tempted to close this, since not an Apache ModProxy dude!

And do assume, that you configured WebTools with a baseurl as /tools ?

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ukdtom/WebTools.bundle/issues/478#issuecomment-359957026, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqF1jfSyfjRxjdb6GkG9PHy5qwwwL-jks5tNmClgaJpZM4Rp8L4 .

erkston commented 6 years ago

Having this same issue (also using apache reverse proxy), did you manage to figure out what the problem was?

mrtumnus commented 6 years ago

I disabled the Rewrite rule, but the issue still happens. Which appears to not be needed anymore, since Plex now routes '/' to '/web/index.html' on its own. Love those devs šŸ˜†

I tried accessing the /tools/api/v3/git/getReleaseInfo/url/https://github.com/ukdtom/WebTools.bundle/version/latest endpoint directly in a browser, and I get a "Fatal error happened in getReleaseInfo". So, it seems that the endpoint does exist and is routed properly by the proxy. Here is the log from this operation:

2018-01-29 11:19:29,243 (7f8d94ff9700) :  DEBUG (apiv3:66) - Recieved an apiV3 call for module: GIT for method: GET
2018-01-29 11:19:29,250 (7f8d94ff9700) :  DEBUG (gitV3:977) - Function to call is: GETRELEASEINFO with params: ['url', 'https:', '', 'github.com', 'ukdtom', 'WebTools.bundle', 'version', 'latest']
2018-01-29 11:19:29,251 (7f8d94ff9700) :  INFO (gitV3:854) - Starting getReleaseInfo
2018-01-29 11:19:29,255 (7f8d94ff9700) :  DEBUG (gitV3:890) - Getting release info from url: https:/releases/latest
2018-01-29 11:19:29,257 (7f8d94ff9700) :  DEBUG (networking:166) - Requesting 'https:/releases/latest'
2018-01-29 11:19:29,262 (7f8d94ff9700) :  CRITICAL (gitV3:903) - Fatal error happened in getReleaseInfo was <urlopen error no host given>
erkston commented 6 years ago

Yup, same exact behavior here. Worth noting that when I access webtools from the PMS machine IP I don't get this error so it's almost certainly a proxy issue. I've tried every configuration I could think of but this error persists.

mrtumnus commented 6 years ago

Here's the line where the release check URL is generated: https://github.com/ukdtom/WebTools.bundle/blob/170bd3544bfbcf1bfa39c15df97b77ba97a09fda/http/static/_shared/webtoolsService.js#L28

This does not appear to prepend the BASEURL. Does this happen upstream somewhere in the request? The error popup confirms the BASEURL is not prepended at this point, but later in the error (after "Not Found") the BASEURL appears.

ukdtom commented 6 years ago

When accessing the endpoint you have to be authenticated!

So I entered /tools as the baseurl, and then restarted my WebTools

Then in a browser, I browsed to my box: http://qnap2:33400/tools and authenticated, in order to get the cookie set in the browser. I then in another tab entered: (Note the url encoding!)

http://qnap2:33400/tools/api/v3/git/getReleaseInfo/url/https%3A%2F%2Fgithub.com%2Fukdtom%2FWebTools.bundle

And it worked, since I received a nice xml

As such, I see no error here, but suspect instead your apache conf.

mrtumnus commented 6 years ago

@ukdtom You are correct, this is an Apache issue.

I found the answer here. Modifying my plex/webtools conf file as follows solved the issue for me:

AllowEncodedSlashes NoDecode
ProxyPass /tools http://localhost:33400/tools nocanon
ProxyPassReverse /tools http://localhost:33400/tools nocanon

Thanks for the support, and for not closing the issue right away! :rofl:

erkston commented 6 years ago

Thanks for the help guys, sorted!

ukdtom commented 6 years ago

@mrtumnus

Mind if I copy paste that to the Wiki?

mrtumnus commented 6 years ago

Please do! Hopefully will help others to not get tripped up by this. Of course, many people these days are using nginx (I've been meaning to myself... only so much time to go around).

ukdtom commented 6 years ago

https://github.com/ukdtom/WebTools.bundle/wiki/Configure