Open mariacha opened 1 month ago
@mariacha In PR's: https://github.com/wri/wri_sites/pull/319 https://github.com/wri/wriflagship/pull/1231
Note: in researching how to implement this I noticed the Pantheon docs mentioning remote_addr
and how it "takes into account if the X-Forwarded-For header", but also had a big Warning about the global CDN. Just to be safe I used the X-Forwarded-For
header as the likely best source with remote_addr
as the fallback. In most cases I'd just use remote_addr
but since WRI is a truly global client I thought a more comprehensive approach might be best.
Ok, I tested this out on develop and it's ready to go to live.
@cpmadera This change went up with today's deploy. Can you let me know if the IP addresses are coming through correctly when you get a moment?
remote_addr
) does not match the value pulled by the[webform_submission:ip-address]
on the Pantheon live site only.Dev tasks
wri_zoom
module, add a new webform elementWebformElement
plugin that's "IP address". Examples can be found atweb/modules/contrib/webform/src/Plugin/WebformElement
.getValue
method to return$this->getWebform()->hasRemoteAddr()) ? $this->getRequest()->getClientIp() : ''
. That example was pulled from the code in webform,\Drupal\webform\WebformSubmissionForm::save
.[webform_submission:ip-address]
to use this plugin instead.