Welcome! Log In Create A New Profile

Advanced

Re: Exposing external JSON API in an Nginx custom path?

Francis Daly
November 11, 2018 03:38PM
On Sun, Nov 11, 2018 at 03:55:06PM +0000, Moorage via nginx wrote:

Hi there,

> curl -i http://mesh.example.com:8080
> HTTP/1.1 302 Found
> Location: /mesh-ui/
> Content-Length: 0
>
> I want to expose that UI at an Nginx site custom path.
>
> https://example.com/mesh

So you want the request to nginx of "/mesh/" to become a request to your
upstream server of "/"?

It can be done; however, I suggest that you will find things easier
to reverse-proxy if you can configure the mesh server to expect that
its root is /mesh/, so that it exposes its api at /mesh/api/v1 and it
redirects to /mesh/mesh-ui/

> location ~ /mesh/ {

"~" is not "starts with". You probably want "^~" there instead.

> proxy_pass http://meshproxy;

If you want the request to upstream to be "/mesh/", use that. Otherwise, use

proxy_pass http://meshproxy/;

> proxy_redirect off;

You probably do not want that. Perhaps "proxy_redirect default;"; perhaps
something else based on whatever the mesh service actually returns. From
your example, you may want

proxy_pass / /mesh/;

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Re: Exposing external JSON API in an Nginx custom path?

Francis Daly November 11, 2018 03:38PM

Re: Exposing external JSON API in an Nginx custom path?

Francis Daly November 12, 2018 06:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 324
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready