NGINX Reverse Proxy redirecting instead of proxying

Viewed 3375

i have a NGINX server running as a reverse proxy. Proxy works for windows hosts however i have a owncloud server and the proxy will instead re wright the url to the internal host name or IP address. ex(I type cloud.example.com and my url bar will change to 10.1.1.19 which is unresolvable over wan

i have checked DNS records and made sure NGINX can resolve host name. also tried just forwarding http traffic to cloud server to make sure using domain name was not the issue.

server {
  listen 80;
  listen [::]:80;

  server_name example.com;

  location / {
      proxy_pass http://10.1.1.16:80/;
  }
}

server {
  listen 80;
  listen [::]:80;

  server_name cloud.example.com;

  location / {
      proxy_pass http://10.1.1.19:80/;
  }
}

server {
  listen 80;
  listen [::]:80;

  server_name remote.example.com;

  location / {
      proxy_pass http://10.1.1.17:80/;
  }
}

i just need NGINX to run as a proxy for "cloud.example.com" instead of rewriting URL

1 Answers

I found a partial answer to this -- Why is my Nginx reverse proxy doing a 301 redirect instead of proxying?.

For me, it kept nginx from changing the hostname (i.e. from good-domain.com to 10.1.5.5:8080), but there doesn't appear to be a way to stop nginx from appending the port to the client's request URL.

So, in using the answer referenced above, I was able to go from http://10.1.5.5:8080 to http://good-domain:8080. It's still not where I want to be, but it definitely gets me closer.

Related