nginx proxypass issue
Maxim Dounin
mdounin at mdounin.ru
Fri Mar 21 12:13:25 UTC 2014
Hello!
On Fri, Mar 21, 2014 at 11:22:42AM +0530, Geo P.C. wrote:
> We have a setup in which nginx proxypass is working fine for tomcat like
> this:
>
> server {
> listen 80;
> server_name app.geo.com;
> location /app {
> proxy_pass https://192.168.1.100:8080/app;
> }
>
> Now while accessing http://app.geo.com/app is working fine.
>
> Now we need to access the same application as
> http://app.geo.com/paymentbut we need the tomcat war as same app. We
> configured proxypass as follows:
>
> server {
> listen 80;
> server_name app.geo.com;
> location /payment {
> proxy_pass https://192.168.1.100:8080/app;
> }
>
> But while accessing http://app.geo.com/payment tomcat application app is
> not loading properly. We are not getting any reliable error message.
>
> Can any one please help us to configure on this scenario.
Most likely, the problem is that your backend links various
resources (e.g., images) using "/app/" url prefix, while
externally visible prefix is "/payment/".
Simpliest and most reliable solution is to fix/change backend to use
links you need (many apps have configuration options like
"baseurl" or something like this).
As a hack/workaround, you may also try changing prefix using nginx
itself, e.g., using sub_filter[1]. This approach may have
problems and not recommended though.
[1] http://nginx.org/en/docs/http/ngx_http_sub_module.html
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list