Error when running under NGINX reverse proxy

Stimulsoft Reports.JAVA discussion
Post Reply
hmredeis
Posts: 1
Joined: Tue Sep 03, 2024 8:54 am

Error when running under NGINX reverse proxy

Post by hmredeis »

I'm trying to run the Reports.Java installed in a server under NGINX as reverse proxy configured as following:

Code: Select all

location /hor-rel-tre/ {
    proxy_pass            http://127.0.0.1:8020/;
    proxy_set_header      Host $host;
    proxy_set_header      X-Real-IP $remote_addr;
    proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header      X-Forwarded-Proto https;
    proxy_set_header      X-Forwarded-Prefix /hor-rel-tre;
  }
But the application fail to load because the Stimulsoft tries to load the resources under the URL: https://www.myserver.com/... instead of https://www.myserver.com/hor-rel-tre/...

I suspect this is because the Stimulsoft does not identify internally the reverse proxy location /hor-rel-tre

Here in this line, the library tries to build a context URL as following:
https://imgur.com/a/nc4LaCx

Scheme: https://
Server Name: www.myserver.com
Server Port: 443
Context Path: /
Final URL: https://www.myserver.com/
Correct URL: https://www.myserver.com/hor-rel-tre

The library apparently is not prepared to run under reverse proxy. Any advice to overcome this situation?
Vadim
Posts: 385
Joined: Tue Apr 23, 2013 11:23 am

Re: Error when running under NGINX reverse proxy

Post by Vadim »

Hello

You can define proper url with StiWebVeiwerOptions options.getServer().setController("https://www.myserver.com/hor-rel-tre/...")
Post Reply