Score:0

How do i redirect proxy nginx?

fk flag

I am running 2 geoserver and nginx container. I want to call https://xxx.xxx.com/geoserver the other one https://xxx.xxx.com/geoserver2. The geoserver containers are running behind proxy container. This is default domain.com/geoserver configuration.


location /geoserver {
add_header           Front-End-Https    on;
add_header  Cache-Control "public, must-revalidate";
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://geoserver_geoserver_1:8080/geoserver;
}

How can i call domain.com/geoserver2 I was trying some configuration but when i tried login, the domain redirect geoserver_geoserver_1 this container. but geoserver2 should be running geoserver_geoserver_2 this container.

location /geoserver2/ {
    add_header           Front-End-Https    on;
    add_header  Cache-Control "public, must-revalidate";
    add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://geoserver_geoserver_2:8080/geoserver/;
    proxy_redirect   /geoserver /geoserver2;
}
djdomi avatar
za flag
Does this answer your question? [Nginx reverse proxy + URL rewrite](https://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite)
fk flag
Hello. Thanks for your return. I have tried but it did not work. I would like to call geoport instead of geoserver.
djdomi avatar
za flag
its still not clear yet what is the goal. please update the question that anyone can understand your needs
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.