I've got an Indy HTTP server using the TIdHTTPServer
component. I'm wanting the browser URL to be rewritten like Apache and IIS do using URL Rewrite modules.
For example: If someone goes to https://www.mydomain2.com
I want the URL in the browser to show https://www.mydomain1.com
.
I'm pretty sure using Javascript's history.pushState
is not the answer.
I have tried using Javascript's history.pushState('data to be passed', 'Title of the page', '/www.mydomain1.com');
as an alternative. However, when I go to https://www.mydomain2.com
it appends to the current URL like https://www.mydomain2.com/www.domain1.com
.
My understanding is history.pushState
doesn't allow for a full URL replacement due to security issues.
My server headers being (and I'm just shooting in the dark):
aResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin','*');
aResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Methods','*');
aResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept, Authorization');
aResponseInfo.CustomHeaders.AddValue('Cache-Control', 'no-cache');
I'm having trouble finding a solution.