Answer the question
In order to leave comments, you need to log in
How to make nginx prox for a service on another domain?
There is a main site, let's call it https://example.com
It has a service at /public-service/ There is
also another domain, let's call it https://public-service.com
How can I make sure that ALL requests to this additional domain was proxied to the main domain with the address /public-service/ ?
https://public-service.com -> https://example.com/public-service/
https://public-service.com/second-url -> https://example.com/public-service/
https://public-service.com/another-url -> https://example.com/public-service/
I'm making a proxy but it's proxying the whole site
server {
listen 80;
server_name public-service.com;
location / {
access_log off;
proxy_pass https://example.com/public-service;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect default;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question