Welcome! Log In Create A New Profile

Advanced

Re: Nginx proxy for an endpoint that redirect automatically to another path

Maxim Dounin
November 23, 2020 09:02AM
Hello!

On Mon, Nov 23, 2020 at 05:59:49AM -0500, meniem wrote:

> I'm trying to setup an Nginx proxy that redirect all requests from
> provider.domain.com to proxy.appname.com/provider (where proxy.appname.com
> is the server_name in nginx server)
>
> The configuration of server and location blocks are fine, but the issue is
> that the provider.domain.com is automatically redirecting to
> provider.domain.com/broker/login.php (when I hit the provider.domain.com
> from the browser, it's automatically taking me to
> provider.domain.com/broker/login.php) which give an error with nginx proxy
> when trying to redirect to a non-existent page (proxy.appname.com/provider
> redirect to proxy.appname.com/broker/login.php -> which does not exist)
>
>
> location /provider/ {
> proxy_pass https://provider.domain.com;
> proxy_set_header X-Forwarded-Host $server_name;
> proxy_set_header Host proxy.appname.com;
> error_log /var/log/nginx/appname.log debug;
> proxy_set_header Accept-Encoding text/xml;
> }
>
>
>
> So, how can I set this to redirect all requests from provider.domain.com
> automatically to
> proxy.appname.com/provider (we don't need to mention the full path in
> proxy_pass; as we have multiple endpoints to hi from the provider link such
> as api…etc.)

Check how redirects are returned, and configure proxy_redirect
appropriately. See http://nginx.org/r/proxy_redirect for details.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx proxy for an endpoint that redirect automatically to another path

meniem November 23, 2020 05:59AM

Re: Nginx proxy for an endpoint that redirect automatically to another path

Maxim Dounin November 23, 2020 09:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 304
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