IllegalKim
IllegalKim

Reputation: 23

proxy_pass return redirect in nginx

I am just a beginner who is currently studying nginx. I have questions while using nginx's proxy_pass feature, so I have questions.

My website is test.com (just example).

http://test.com/aaa (This is example address)

-> aaa makes return to '/login/login.cgi'

And what I want is

http://test.com/aaa/login/login.cgi

But I just redirect to

http://test.com/login/login.cgi

And this is my nginx config (deleted unnecessary code)

server {
    location /aaa {
        proxy_pass http://192.168.0.1/;
    }
}

How can I solve it?

Thank you for reading.

Upvotes: 2

Views: 4204

Answers (1)

miknik
miknik

Reputation: 5941

proxy_pass http://192.168.0.1/ <-- Anything you put on the end of here...

location /aaa <-- Replaces whatever you put here.

So in your case /aaa gets replaced by /.

To keep the /aaa all you need to do is remove the slash from the end of your proxy_pass like this:

proxy_pass http://192.168.0.1

Upvotes: 3

Related Questions