LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to redirect HTTP traffic to HTTPS?

Solved!
Go to solution

I setup a web service and host the both HTTP and HTTPS service.

 

Is it possible to redirect all the income HTTP traffic to HTTPS?

 

example:

1) On browser user type http://hostname/webservice/index.html

2) server redirect it to https://hostname/webservice/index.html

 

Best regards,
Khoh

0 Kudos
Message 1 of 4
(2,156 Views)

AFAIK, HTTPS is HTTP over SSL.

 

I think in recent versions you can get LabVIEW to do that for you, but I haven't tried it recently.

 

In the past, I used stunnel for that.

0 Kudos
Message 2 of 4
(2,115 Views)

a bit confuse on using stunnel, can you hint the setup step? I'm using window OS.

 

Best regards,
Khoh

0 Kudos
Message 3 of 4
(2,096 Views)
Solution
Accepted by topic author Keele

I can post what I've used, but I'm no expert, and it's been a few years since I last used it.

 

I can validate that setting it up wasn't trivial, but once it was setup, it worked like a charm.

 

I hope you've found the howtoI bookmarked that in my project, it's been a great help.

 

In the stunnel.conf below I bolded the things that I changed. IIRC, the incoming HTTPS on port 8080 is automatically routed. This could require a certificate (it did for me) and that was the hard part. Certificates are hard. IIRC, I created my own, using OpenSSL (sslcerts.html). You might not need it for all HTTPS connections, or you might need a specific certificate. I think it's application specific.

 

I think I left everything that comes with stunnel untouched, except the stunnel.conf. Even that file was mostly unchanged, except the bolded parts. I'm not sure about the https2:


; Certificate/key is needed in server mode and optional in client mode
; The default certificate is provided only for testing and should not
; be used in a production environment

 

cert = certificate\\myapp.pem
key = certificate\\myapp-insecure.key

 

; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1

 

; Authentication stuff;
verify = 0


; Don't forget to c_rehash CApath
;CApath = certs
; It's often easier to use CAfile
;CAfile = cnes_certificate.pem
; Don't forget to c_rehash CRLpath
;CRLpath = crls
; Alternatively you can use CRLfile
;CRLfile = certificate.pem

 

; Some debugging stuff useful for troubleshooting
debug = 7
;output = stunnel.log

; Use it for client mode
;client = yes

; Service-level configuration

 

[https]
connect = localhost:80
accept = localhost:8080
;TIMEOUTclose = 0

 

[https 2]
accept = 443
connect = 80


 

0 Kudos
Message 4 of 4
(2,088 Views)