0

How can I get the equivalent of php:

$_SERVER['HTTP_ORIGIN']

in delphi?, I'm using TWebRequest in a WebBroker applications project (not datasnap).

  • I think you need GetFieldByName —Request.GetFieldByName('ORIGIN'), where Request is some instance of TWebRequest. – sideshowbarker Jul 03 '18 at 01:31
  • I also thought the same, I even tried but it did not work. The TWebRequest class has properties for some headers but I did not find any to read 'Origin'. – Ezequiel Uh Jul 04 '18 at 15:12

1 Answers1

1

It works using Request.GetFieldByName ('ORIGIN') where Request is some instance of TWebReques. However, there are "hidden" headers, to obtain them you can use a solution based on the response of the following link: Enumerate TWebRequest HTTP header fields, and save them in a TDictionary

  • Request.GetFieldByName ('ORIGIN') works for me with Delphi 11 in August 2022. Note that the beginning of the origin will be 'http://' or 'https://' so you may need to strip that off before deciding whether to allow access from the particular domain name. – Anon E. Mouse Aug 04 '22 at 03:34