Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for multi-domain usage for allowed-origin #9

Open
Dzyszla opened this issue Aug 6, 2024 · 0 comments
Open

Proposal for multi-domain usage for allowed-origin #9

Dzyszla opened this issue Aug 6, 2024 · 0 comments

Comments

@Dzyszla
Copy link

Dzyszla commented Aug 6, 2024

Hi,

I have some sugesstion for modyfication. Browswers don't allow multiple domains, so if I want do this, I must to make this:

procedure(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED(FPC)}TNextProc{$ELSE}  TProc {$ENDIF})
var
	sl: TArray<String>;
	Origin: String;
begin
	sl := MyAllowOrigin.Split([',', ';']);

	Origin := Req.Headers['Origin'];
	if not MatchText(Origin, sl) then
		Origin := 'null';

	HorseCORS()
		.AllowedOrigin(Origin);

	CORS(Req, Res, Next);
end;

Maybe can some similar put into horse-cors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant