question

CSN avatar image
1 Like"
CSN asked laary commented

FlexSim Webserver support HTTPS?

Hi,guys,

Does FlexSim Webserver support HTTPS transfer? And how to import the certificate?

Thanks


FlexSim 22.2.1
flexsim webserver
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

Phil BoBo avatar image
2 Likes"
Phil BoBo answered laary commented

You could use a reverse proxy to allow SSL with a valid cert that goes between the flexsim web service running without SSL and the public address that you access it from.

Alternatively, you can modify line 371 of C:\Program Files (x86)\FlexSim Web Server\webserver\server.js to use https instead of http. There's a commented-out example in the lines above it:

1663077358135.png


1663077358135.png (249.4 KiB)
· 4
5 |100000

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

laary avatar image laary commented ·

Hello, we're not familiar with node js. How do we point the certicate to the node.js?

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ laary commented ·

@laary,

When you issue the certificate you would configure it to point to some URL of your choosing, like flexsim.mycompany.com.

In Phil's example code, shown in the image attached to his answer, you would comment out line 371 ("var flexsimServer..."), and un-comment lines 363-369.

In the un-commented chunk you need to reference the path to your certificate and key files. Modify the paths ("ssl/key.pem", "ssl/cert.pem") to point to paths on your webserver's file system where you have stored your certificate and key files. The location needs to be accessible by node.js. To use those default locations ("ssl/key.pem, "ssl/cert.pem"), you would create an ssl directory in the C:\Program Files(x86)\FlexSim Web Server\webserver directory. Then place your cert.pem and key.pem files in the ssl directory you just created.

Also, you will need to change the port in the 'flexsim webserver configuration.txt' file from 80 to 443.

0 Likes 0 ·
laary avatar image laary Ben Wilson ♦♦ commented ·
This one works. Thanks @Ben Wilson
0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

In regards to using "a reverse proxy to allow SSL with a valid cert", please reference Paul Toone's recent articles on setting up behind a proxy:

0 Likes 0 ·