Skip to content

Pass the request to another reverse proxy server #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
geek-baba opened this issue Jun 23, 2020 · 7 comments
Closed

Pass the request to another reverse proxy server #472

geek-baba opened this issue Jun 23, 2020 · 7 comments

Comments

@geek-baba
Copy link

This is working great for most use cases I have except when I am trying to redirect to another proxy service running on my Kubernetes cluster. The K8s cluster is running nginx ingress (proxy) and it should route to specific app based on the domain name. However looks like when I am passing it via nginx proxy manager to my k8s cluster, the url/domain name is not passed to it.

So in simplest terms I want to pass domain name from one nginx server to another for further processing, is this something possible?

@pantherale0
Copy link

Try setting these in the advanced config:

    proxy_set_header Host            $host;
    proxy_set_header X-Forwarded-For $remote_addr;

@geek-baba
Copy link
Author

It does not work, also it says on advance config page:

Nginx variables available to you are:

$server # Host/IP
$port # Port Number
$forward_scheme # http or https

@saschamander
Copy link

@geek-baba Did you find any solutions for this?

I'm currently struggling to achieve the almost the same.
(For my case there is no kubernetes involved.)

Also found this issue #286 which seems to cover the same topic.

@geek-baba
Copy link
Author

I had to separate the this proxy and k8s cluster to point to 2 different static IP's

@jhs512
Copy link

jhs512 commented Feb 9, 2023

i solved this problem by this way : https://stackoverflow.com/questions/37523615/dynamic-proxy-pass-in-nginx-to-another-pod-in-kubernetes

After much research and trial and error I managed to solve this. First I changed the pod specification to:

spec:
containers:
- name: nginx
image: "nginx:1.10.0"
ports:
- containerPort: 8080
name: "external"
protocol: "TCP"
- name: dnsmasq
image: "janeczku/go-dnsmasq:release-1.0.5"
args:
- --listen
- "127.0.0.1:53"
- --default-resolver
- --append-search-domains
- --hostsfile=/etc/hosts
- --verbose
then I also had to disable the ipv6 for the resolver in nginx:

location ~ ^/(.+)$ {
resolver 127.0.0.1:53 ipv6=off;
set $backend "http://$1:80";
proxy_pass $backend;
}
Then it works as expected!

Copy link

Issue is now considered stale. If you want to keep it open, please comment 👍

@github-actions github-actions bot added the stale label Mar 28, 2024
Copy link

github-actions bot commented May 8, 2025

Issue was closed due to inactivity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants