Reverse proxy 404 error help!

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reverse proxy 404 error help!

Soon Hyouk Lee
Trying to get Unifi (ubiquiti networks) video controller up via nginx reverse proxy, but I keep getting 404 errors by my app.  Seems it is trying to pull css from the wrong location and getting 404 errors.  when I request [hostname]/unifi/ it goes to a white page but doesn't give me an explicit error, so the location block is working to pull up a base static page, but clearly not anything else is functioning.

Error log shows that the css files needed are being referenced using the root directory defined in the '/' location block rather than the root specified in the '/unifi/' location block.  Looking at network developer tools in chrome / firefox shows 404 errors for css pages being called by the app.

Can anyone provide some much needed assistance?  I've been at this for hours, changing various things in the config without any progress!  Not sure if it's just syntax associated with the rewrite or if it's something more fundamental.  If I change the root to the app's appropriate directory at the '/' location block then some of the 404 errors are eliminated.  I will also need to figure how to get websocket to work for this once I can get the login page to load.



nginx config below:

https://pastebin.com/0KihFgEP

error log from nginx below:

https://pastebin.com/aWBmLSX3
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Reverse proxy 404 error help!

Francis Daly
On Thu, Aug 29, 2019 at 10:54:33PM -0400, Soon Hyouk Lee wrote:

Hi there,

some web services are not set up to be friendly to be reverse-proxied
at a different part of the local url hierarchy than they know about.

Perhaps this is one of them.

If you can configure the back-end server to believe that it is rooted
at /unifi/ instead of at /, then perhaps it can work.

Otherwise, you may have more luck using a dedicated server{} block that
reverse proxies everything to the unifi service without changing the
local url.

The other option, of trying to rewrite the content on-the-fly, is unlikely
to work reliably.

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Reverse proxy 404 error help!

Soon Hyouk Lee
Thank you!  Can confirm that indeed reverse proxy at ‘/‘ location succeeds.

I used subdomain (unifi.mydomain.com) to accomplish app-specific address but at the ‘/‘ location using a dedicated server block as instructed.

Thank you!

> On Aug 30, 2019, at 3:54 PM, Francis Daly <[hidden email]> wrote:
>
> On Thu, Aug 29, 2019 at 10:54:33PM -0400, Soon Hyouk Lee wrote:
>
> Hi there,
>
> some web services are not set up to be friendly to be reverse-proxied
> at a different part of the local url hierarchy than they know about.
>
> Perhaps this is one of them.
>
> If you can configure the back-end server to believe that it is rooted
> at /unifi/ instead of at /, then perhaps it can work.
>
> Otherwise, you may have more luck using a dedicated server{} block that
> reverse proxies everything to the unifi service without changing the
> local url.
>
> The other option, of trying to rewrite the content on-the-fly, is unlikely
> to work reliably.
>
>    f
> --
> Francis Daly        [hidden email]
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx