IsSecureConnection() is Not working in Timer Action

IsSecureConnection() is Not working in Timer Action

  

I tried to get the Application is deployed in Prod Or Dev Env. I mean it is HTTP or HTTPS. For this I have used  IsSecureConnection() method inside Timer Action.

But I didn't get proper value. 

Can any one help on this?

Hello Subramanyam,

A timer will always be executed by the Scheduler Service, even if you awake it through a Wake action.

So, there is really no point in detecting if the connection is secure or not, as it is not comming from the "client" or the outside world...

IMHO you shouldn't have code, in production, meant to execute only in dev.
This is an architecture failure.

Exactly what are you trying to avoid to run in Production, taht you can't separate in a different module (and even application), and don't pass it to Production?

Why do you need to identify if it is a Production or Dev environment?

Cheers.

Eduardo Jauch wrote:

Hello Subramanyam,

A timer will always be executed by the Scheduler Service, even if you awake it through a Wake action.

So, there is really no point in detecting if the connection is secure or not, as it is not comming from the "client" or the outside world...

IMHO you shouldn't have code, in production, meant to execute only in dev.
This is an architecture failure.

Exactly what are you trying to avoid to run in Production, taht you can't separate in a different module (and even application), and don't pass it to Production?

Why do you need to identify if it is a Production or Dev environment?

Cheers.


Hi Eduardo Jauch,

Thanks for your reply. Here my intention is , If the Application in secured then i have to send application URL with "https://Some URL" or "http://Some URL" by Email.

I Scheduled a Timer to trigger the Email, So i have to send this data.


Solution

Hum...

Take a look here: https://success.outsystems.com/Documentation/10/Managing_the_Applications_Lifecycle/Secure_the_Applications/Enforce_HTTPS_Security

You can set the environment Production to force https (or application), so even if the request is http, it will be redirected to https. This way you don't have to wrroy about this in your code.

Cheers.

Solution

Eduardo Jauch wrote:

Hum...

Take a look here: https://success.outsystems.com/Documentation/10/Managing_the_Applications_Lifecycle/Secure_the_Applications/Enforce_HTTPS_Security

You can set the environment Production to force https (or application), so even if the request is http, it will be redirected to https. This way you don't have to wrroy about this in your code.

Cheers.

if we still want to set http or https by logic using code then what is the way to do it?


Hello Salman, 

Not sure I understood.

If you want to set in the caller, you just need to define if you want the request to be made through http or https.
If you're talking about doing this in the code, server side (the code that receives the request), I don't think it is possible, once the request would already being processed by the server?

Eduardo Jauch wrote:

Hello Salman, 

Not sure I understood.

If you want to set in the caller, you just need to define if you want the request to be made through http or https.
If you're talking about doing this in the code, server side (the code that receives the request), I don't think it is possible, once the request would already being processed by the server?

Done.it possible like below.


Just to be sure, what are you doing exactly?
Changing http to https in links?
Or are you doing something different?

If your page is set to require HTTPS, then any links to it in the email, assume you use a link to the page, will be correct.

Using IsSecureConnection in your timer makes no sense at all. Regardless of what logic you think it should or should not be running, it will always return False.

J.Ja

Justin James wrote:

If your page is set to require HTTPS, then any links to it in the email, assume you use a link to the page, will be correct.

Using IsSecureConnection in your timer makes no sense at all. Regardless of what logic you think it should or should not be running, it will always return False.

J.Ja


Above working for me to set pdf path for an Iframe.
actually on UAT it requires Https but in local it used Http only.So I have added conditionally.

Regardless, it's a good idea to use HTTPS always, even on development. E.g. REST services don't work without them (or at least not without warnings). And detecting the difference between development and production based on whether the client is connecting with HTTP or HTTPS is just plain madness.