E
E
EVOSandru62021-10-06 14:41:15
Nginx
EVOSandru6, 2021-10-06 14:41:15

How to properly proxy the site through proxy_pass in nginx and not catch a redirect?

Hey guys.

The problem is that when you open the page:
https://local-domen
It redirects to:
https://super-secret-store.com
And I would not want to redirect from my domain.
How can this be prevented?

There is such a config.

server {
  listen 443 ssl http2 default_server;
  listen [::]:443 ssl http2 default_server;

  server_name local-domen;

  include snippets/snakeoil.conf;

  location / {
      sub_filter_once off;
      sub_filter_types *;
      proxy_pass https://super-secret-store.com;
      proxy_redirect off;
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-10-06
@ky0

Redirects what you are accessing in the proxy pass, and not the specified config. Remove such behavior from there (as well as absolute links, which also fire your "secret domain", for example) - and everything will be as you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question