Error when running under NGINX reverse proxy

Stimulsoft Reports.JAVA discussion
Post Reply
hmredeis
Posts: 5
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: 409
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/...")
hmredeis
Posts: 5
Joined: Tue Sep 03, 2024 8:54 am

Re: Error when running under NGINX reverse proxy

Post by hmredeis »

Thanks for the help @Vadin. It really did the trick.
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Error when running under NGINX reverse proxy

Post by Lech Kulikowski »

Hello,

You are welcome.
komozuro
Posts: 1
Joined: Wed Dec 25, 2024 8:40 pm

Re: Error when running under NGINX reverse proxy

Post by komozuro »

hmredeis wrote: Thu Sep 19, 2024 7:23 pm Thanks for the help @Vadin. It really did the trick.
How could you solve this problem?
could you share the modified file or where to edit that StiWebVeiwerOptions ?
Thanks
Lech Kulikowski
Posts: 7332
Joined: Tue Mar 20, 2018 5:34 am

Re: Error when running under NGINX reverse proxy

Post by Lech Kulikowski »

Hello,

Please check the following link:
https://www.stimulsoft.com/en/documenta ... ptions.htm

Thank you.
Post Reply