Page 1 of 1

Error when running under NGINX reverse proxy

Posted: Tue Sep 03, 2024 6:30 pm
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?

Re: Error when running under NGINX reverse proxy

Posted: Wed Sep 04, 2024 8:33 am
by Vadim
Hello

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

Re: Error when running under NGINX reverse proxy

Posted: Thu Sep 19, 2024 7:23 pm
by hmredeis
Thanks for the help @Vadin. It really did the trick.

Re: Error when running under NGINX reverse proxy

Posted: Fri Sep 20, 2024 4:12 pm
by Lech Kulikowski
Hello,

You are welcome.

Re: Error when running under NGINX reverse proxy

Posted: Wed Dec 25, 2024 8:43 pm
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

Re: Error when running under NGINX reverse proxy

Posted: Fri Dec 27, 2024 10:25 am
by Lech Kulikowski
Hello,

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

Thank you.