Https on debug run

Hi,

I am working with 3rd party web app that will call my xojo webservice. This 3rd party web app requires https to post a message.

Can I run my xojo web app as https under DEBUG mode?

Yes

“https” debug not so sure maybe just test using http using #if DebugBuild

the 3rd party web app requires https to send message. I want to catch it on my local pc while im in the IDE mode.

Is it possible?

With Web 1.0 there was an example called SSLTest, it is no longer in Web 2.0.
I was able to test the example using Xojo 2018r3 don’t know if the certificate (with all the browser updates) can work as it worked 3-4 years ago.

Here the instructions from that example:

Hope this helps.

1 Like

This doesn’t appear to work in Web 2.0 anymore :frowning:

I was able to confirm that the Web 1.0 instructions do still work.

IMO it’s strange that you can’t put the secureport in the “Command Line Arguments” field.

I was able to make it work in Web 2.0, here running in Safari port 8080


port 8082

Thanks for the tip, I put the secureport in there and I just need to Run and not Run Paused
image
maybe the Web 1 example was created when Xojo didn’t offer Command Line Arguments?

1 Like

What I did on my mac:

  • new Desktop/SSLTest folder
  • copy SSLTest.crt and SSLTest.xojo_binary_project from Xojo2019r1.1 (the one I have installed) to the folder above
  • open the SSLTest.xojo_binary_project in Xojo2021r3.1
  • click continue on all the warnings
  • add --secureport=8082 to Debug Command Line Arguments
  • Run

When you try to open the https://localhost:8082 your browser will complain, just say that you are sure what you are doing. I was able to do a self signed certificate for localhost, add it to the keychain and Safari works as normal (no warnings).

Can anyone confirm the same on another mac (I use Mojave so don’t know if newer OS will affect this and maybe that is why Tim was not able to make it work) and Windows.

I debug secure all the time. Build step to copy the pre-configured cert and the command line argument are all that’s needed.

Hm I wonder what went wrong for me ¯\_(ツ)_/¯

Good to know it works though.

This makes no sense since you can set the SSL Port with 8082 rather than set the secure port with a command line argument.

Can you explain the value of this response if the example isn’t available and the framework has changed? It might not work under web 2.0.

Hi Anthony,
Can you provide specifics? How are you setting the builder to copy the pre-configured cert file. Maybe a screen shot or example project would be helpful.

The SSL Port option is for builds, the command line argument is to indicate the secure port while debugging.

You can download an older Xojo that includes the Web 1.0 sample (it includes the copy step) and follow my post above

Another possible deployment scenario:

Use haproxy to handle the SSL interaction. I can confirm that this can definitely be done on Linux, and perhaps others can confirm the Mac and Windows platforms.

Haproxy listens on the secure port (could be port 443, but can be a different port), and the SSL cert files are concatenated into a single file that haproxy loads. Your Xojo web service can listen on an internal port, such as 8080, and at that point, the requests that are forwarded by haproxy are in an unencrypted stream.

By moving the SSL interactions into haproxy, the Xojo side is greatly simplified.

I do this on a co-located mac mini in the cloud. In my case, haproxy is not the front end to a Xojo web project, it is the front-end that provides (among other things) the SSL termination for incoming requests that get routed to Aloe Express.

But the theory is probably the same: haproxy accepts in the SSL requests on port 443, and based on haproxy rules I setup, forwards it unencrypted to some other port where my Xojo apps process it and respond. (And haproxy also inserts extra headers so I can tell the original IP, port like 443 vs 80, etc)

1 Like

Follow the steps here to generate a local test certificate. Add a Build Step to your project for Debug that copies the resulting combined certificate file to the App Parent Folder:

image
image

For Windows: the certificate file needs to be named like DebugMy Application.crt
For macOS: the certificate file needs to be named like My Application.crt

Basically, the certificate file has to have the same name as the exe/app. I assume Linux follows the same convention, but I don’t debug secure on Linux often.

In Build > Shared > Debug > Command Line Arguments, I have the following:
--secureport=8081 --maxsecuresockets=400

image

Which allows me to debug by accessing https://localhost:8081

3 Likes

Hi, I’m still having trouble getting this to work. Can someone help troubleshoot my localhost for issues?

Are you using the Certificate from Xojo 2019 or new certificate?
Is your app and certificate named the same?
Do you get any errors when trying to connect to the secureport?
Can you share your certificate and sample application?
What OS/Browser do you use?

Try this sample: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free