V
V
Vitali Kulinich2016-11-28 18:29:50
Nginx
Vitali Kulinich, 2016-11-28 18:29:50

Nginx URL without redirect?

Good afternoon,
Nginx works as a reverse proxy, with a redirect to port 443.
You need to make sure that it does not redirect to a specific URL. I do so
server {
listen 80;
server_name example.com www.example.com;
location = /test/{
proxy_pass http://10.33.2.17;
}
return 301 https://$host$request_uri;
}
But it redirects, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2016-11-29
@amatol

Describe your question in more detail, please. If I understand you correctly, you need to make the location with the "non-redirected" url a higher priority than the default one. The easiest way to do this is to remove your return from the root, something like this:

server {

location = /test {
proxy_pass http://10.33.2.17;
}

location / {
return 301 https://$host$request_uri;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question