Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Problem routing 2 almost similar url's (windows)

$
0
0
Hi,

I am trying to setup route to these 2 url's that are located on the same server and port. Weblogic is handling the incoming traffic on the server/port and directs accordingly.

https://bi.mydomain.com/analytics/
https://bi.mydomain.com/xmlpserver/

Current nginx config looks like this:

server {
listen 80;
server_name bi.mydomain.com;
location / {
return 301 /analytics;
}
location /analytics {
proxy_pass http://server011:9502/analytics;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /xmlpserver {
proxy_pass http://server011:9502/xmlpserver;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

This does not work. Instead I have tried to add 2 separate server blocks like this:

server {
listen 80;
server_name bi.mydomain.com/analytics;
location / {
proxy_pass http://server011:9502/analytics;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server {
listen 80;
server_name bi.mydomain.com/xmlpserver;
location / {
proxy_pass http://server011:9502/xmlpserver;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

With this config nginx complains about the use of / in the server_name.

I am a bit puzzled on how to resolve this?

Thanks in advance for any help!

Cheers
thg

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>