question

Mischa Spelt avatar image
0 Likes"
Mischa Spelt asked Mischa Spelt commented

Webserver not working behind prefixed proxy

Hi,

I was looking into using nginx as a reverse proxy for the FlexSim HTTP web server and ran into an issue when using path prefixes. I have nginx listening on port 443 and the FlexSim web server on port 4200, so the relevant part of my nginx config looks like this:

  1. server {
  2.     listen       443 ssl;
  3. server_name example.com
  4.     <snip> # server_name and ssl_ configuration here
  5.     location /model/ {
  6.       proxy_pass      http://127.0.0.1:4200/;
  7.     }
  8.   }

So the idea is that going to https://example.com/model should show the FlexSim server... and that works! Almost! I get the interface and I can start an instance:

1675761344155.png

But when I try to connect to the instance I get a 404 not found. The problem seems to be that somewhere in the internals of the webserver, it constructs an incorrect path:

1675761424517.pngIt tries to load

  1. /model/webserver.dll/queryinstance=tutorials\FlexSim 2023\StatisticsCollectorTutorialModel&instancenum=1/?defaultpage&dashboardstats=1&time=1675761445901

but that gives a 404 Not Found error.

I guess one solution is: then don't use the reverse proxy... but this feels like I should be able to get it to work but it's just a small bug... right? :-)

FlexSim 23.0.3
webservernginx
1675761344155.png (37.1 KiB)
1675761424517.png (36.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Jacob Gillespie avatar image
0 Likes"
Jacob Gillespie answered Mischa Spelt commented

That configuration looks good. I just tried it myself and it was going to /model on the other side of the proxy until I put a / on the end (ie http://127.0.0.1:4200/ ).

Maybe try restarting the daemon?

· 6
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.