RTC Forums
November 23, 2024, 11:25:30 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
How can I add headers to the responses from a web server?
Pages: [
1
]
« previous
next »
Print
Author
Topic: How can I add headers to the responses from a web server? (Read 4571 times)
brian71us
RTC Expired
Posts: 15
How can I add headers to the responses from a web server?
«
on:
September 16, 2016, 03:56:13 PM »
I am building a web server and providing remote functions using Real Thin Client. The application will need to provide the cross origin (CORS) header to allow the browser to make requests from the server. How do I add a header to the response? I need to add the header 'Access-Control-Allow-Origin' with a value of '*'. It would be best if this could be done directly from the TRtcHttpServer itself so it would work for all remote procedure calls (TRtcFunction).
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: How can I add headers to the responses from a web server?
«
Reply #1 on:
September 16, 2016, 07:58:23 PM »
You can add any response header using ...
TRtcDataServer(Sender).Response['response-header-name']:='response-header-value';
... from any RTC event triggered before the response header was sent.
For example, you could do it from the
OnRequestAccepted
event on the
TRtcServerModule
component responsible for executing your remote functions if you only want it for remote functions handled by that RtcServerModule, or from the
OnRequestAccepted
event on the
TRtcHttpServer
component if you want it for ALL requests accepted for that Server.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...