question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keepalive/ping component should have some config options

See original GitHub issue

Currently the KeepAlive component (see https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Web/Scheduling/KeepAlive.cs) uses the _runtime.ApplicationUrl to send a request to itself. Typically we require that an Umbraco website can send requests to itself based on the external configured URL for the website which normally requires configuring some internal DNS resolution. This might not always be possible in all hosting scenarios, so we want to be able to configure this component with some options:

  • Best to create a new interface: IKeepAliveOptions
  • The interface should contain 2x properties (for now, maybe more later)
    • Disable (bool) - which would forcibly disable keep alive from running
    • KeepAliveUrl (string) - this could be null and in which case the KeepAlive component would just continue to use the _runtime.ApplicationUrl
  • The ctor of the Umbraco.Web.Scheduling.KeepAlive should then have another ctor parameter of type IKeepAliveOptions which could be an optional parameter that defaults to NULL
  • Then the component’s code needs to be updated to use these options if they are not null
  • Then the Umbraco.Web.Scheduling.SchedulerComponent needs to be updated to pass in an instance of IKeepAliveOptions in the RegisterKeepAlive
    • For now, it will be easiest to create an internal class KeepAliveOptions which implements IKeepAliveOptions which reads from appSettings, these keys could be used (which could be added as constants to Umbraco.Core.Constants.AppSettings)
      • “Umbraco.Web.KeepAlive.Disabled”
      • “Umbraco.Web.KeepAlive.Url”

(Original post below…)

Umbraco version

I am seeing this issue on Umbraco version: 8.1.3

Reproduction

Bug summary

The Ping action in the KeepAliveController only allows local request. If requests are not coming from localhost, the OnlyLocalRequests attribute returns a 404. In my case, the ‘umbracoApplicationUrl’ is set to ‘https://admin.mysite.com/umbraco’. This setting is being used by the KeepAlive RecurringTaskBase.. The task sends an HTTP GET request to ‘https://admin.mysite.com/umbraco/api/keepalive/ping’. When making that request, a 404 is return because of the OnlyLocalRequests attribute.

This is causing the logs to be full of 404 issues. Can we change the behavior for the KeepAlive task so it can use a new base URL setting specifically for KeepAlive? Alternatively, it would be great to be able to turn off the KeepAlive functionality?

Specifics

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Shazwazzacommented, Nov 12, 2019

Yep for sure, we need some options specifically for keep alive since the umbraco url might not ever be an internally resolvable one. I’ll update the title of this task, add some notes and mark as up for grabs.

1reaction
Shazwazzacommented, Nov 11, 2019

Hi, for reference, the controller is here https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Web/Editors/KeepAliveController.cs and the local only attribute is here https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Web/WebApi/Filters/OnlyLocalRequestsAttribute.cs

Normally we recommend that your server hosting the website can access itself on the public URL. Traditionally speaking this might mean changing local DNS settings or even a hosts file. You cannot edit any hosts file on azure app service and i’m unsure if there’s any reasonable work arounds for that. I’m sure it’s possible one way or another but that’s not something I’ve ever looked in to, wonder if some azure experts would know a nice way to do this? I found this but it’s not all that helpful https://stackoverflow.com/questions/45243476/azure-app-service-internal-dns-resolution

A work around (sort of), is to just ignore the error in your log config so it’s not filling up your logs. Of course this still means that the keep alive service isn’t actually working. There’s some docs on how to do this here https://our.umbraco.com/documentation/reference/config/Serilog/ and you could change the minimum logging level of Umbraco.Web.Scheduling.KeepAlive to Fatal (anything higher than Error)

Azure app service itself i believe has the ability to keep alive it’s own service so we should have the ability to configure the built in one in order to just disable it.

What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need to be careful when you using gRPC keepalive - Allen Ng
In the grpc keepalive proposal, there are a lot of configurations that we can set, this time we will use golang as an...
Read more >
gRPC service keepalive configuration not working #2356
We have a gRPC dotnet core service running on Kubernetes behind Nginx Ingress. ... if we keep sending keepalive pings, Nginx server should...
Read more >
Angular 6 ng-idle - keep alive
So I have the ng-idle and KeepAlive up and running in my app.component.ts but since I'm using lazy loading, I also have an...
Read more >
TCP Keepalive Best Practices - detecting network drops ...
As a work-around, to detect network drops more quickly, and retry jobs sooner, adjust the TCP Keepalive settings on the master server to ......
Read more >
Enabling or Disabling HTTP Keep Alive
This section describes how to change HTTP Keep-Alive settings for a single server configuration of PIA. When in production, a multi server configuration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found