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

Issue with non http and https Origins #37

Closed
babarinde opened this issue Dec 23, 2021 · 3 comments
Closed

Issue with non http and https Origins #37

babarinde opened this issue Dec 23, 2021 · 3 comments
Labels
Invalid This doesn't seem right

Comments

@babarinde
Copy link

Bug Report

Q A
Version(s) x.y.z

Summary

When a request is made from an origin that its scheme is not http(s), the pre flight request fails and we understand that this may be caused by the URI factory

Current behavior

When our Origin is capacitor://xyz.com, pre flight request fails

How to reproduce

Make a preflight request with a non http(s) scheme

Expected behavior

Preflight and CORS request should proceed as this is a valid URI

@babarinde babarinde added the Bug Something isn't working label Dec 23, 2021
@boesing
Copy link
Member

boesing commented Mar 23, 2022

Hey @babarinde,
thanks for the feedback here.

Can you probably create a failing unit test for this?
I am not 100% sure if I can follow every path in my head of what your problem is and this would help us to narrow down the issue.

Thanks in advance!


Although: how does your CORS config look like?

@babarinde
Copy link
Author

babarinde commented Mar 23, 2022

Thanks for your feedback its a custom origin scheme actually like this but in this case the scheme is capacitor instead of android

Config:
`<?php

use Mezzio\Cors\Configuration\ConfigurationInterface;

return [
ConfigurationInterface::CONFIGURATION_IDENTIFIER => [
"allowed_origins" => ["*"],
"allowed_headers" => ["Content-Type", "Accept", "Authorization", "X-API-KEY", "X-APP-ID"],
'credentials_allowed' => true,
'allowed_max_age' => '600',
]
];
`
we see that Uri from laminas is called and allowed schemes are linked to

@boesing
Copy link
Member

boesing commented Mar 23, 2022

I don't think that this is the right component you should raise the concern.
The main problem seems to be how your project is bundled.

If you are using diactoros and that component does not provide the required features you are expecting, you can either change the psr/http-factory implementation or create an issue in the diactoros component.

The CORS component does not require a specific PSR-17 implementation and therefore already provides the possibility to change the implementations. We do need a PSR-17 UriFactory as parsing URLs is not the job of this component.


Please either create an issue in laminas-diactoros or change the underlying PSR-17 implementation of your project.

@boesing boesing closed this as completed Mar 23, 2022
@boesing boesing added Invalid This doesn't seem right and removed Awaiting Author Updates Bug Something isn't working Unit Test Needed labels Mar 23, 2022
@boesing boesing pinned this issue Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants