umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
29 stars 0 forks source link

Umbraco.Forms 13.1.2 records are missing an IP address when the site is behind Cloudflare CDN #1245

Closed stephen-sherman closed 1 week ago

stephen-sherman commented 1 week ago

Bug summary

Umbraco.Forms 13.1.2 records are missing an IP address when the site is behind Cloudflare CDN.

Specifics

Observed in multiple solutions running Umbraco.Forms 13.1.2 behind Cloudflare CDN.

This seems similar to Issue #1000, though I can't find any documentation about how to use the fix outlined therein.

Steps to reproduce

Expected result

The user's IP address is stored in the IP column of the record in the UFRecords database table.

Actual result

The IP column of the record in the UFRecords database table is empty.

AndyButland commented 1 week ago

Seems our documentation has got a bit our of date here, so sorry for the confusion if that turns out to be the case.

On the linked issue - I've added a comment there - but in fact those options weren't in the end released and hence that's why they aren't documented.

As of Forms 12, EnableRecordingOfIpWithFormSubmission is disabled by default. So it might be just that you need to explicitly enable that by setting the option to true.

If you've done that, it would be worth independently inspecting what you have coming through for httpContext.Connection.RemoteIpAddress in your environment. As that's what is read by Forms to populate this field.

Meantime, I'll create a PR to get the docs up to date...

stephen-sherman commented 1 week ago

Thanks Andy, confirming that this was indeed caused by a change in the default setting of EnableRecordingOfIpWithFormSubmission. It is now capturing IP addresses as expected with this explicitly set to true.