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

Referer is NULL when Kirby URL is '/' #101

Open
lemmon opened this issue Nov 25, 2024 · 5 comments
Open

Referer is NULL when Kirby URL is '/' #101

lemmon opened this issue Nov 25, 2024 · 5 comments

Comments

@lemmon
Copy link

lemmon commented Nov 25, 2024

The Submission Page checks for referer and validates host against Kirby.

if ($site->host() === $path->host()) {

However problem occures when Kirby config url is set to '/'. Hosts obviously don't match and therefore the valid referer is not set.

@tobimori
Copy link
Owner

Why do you have to use this setup? Shouldn't it work perfectly fine without the / in config.php?

@lemmon
Copy link
Author

lemmon commented Nov 25, 2024

This is a case when Kirby is used as a headless cms. I need all the urls rendered without host accross whole Kirby. Even the documentation says it is fine to use this setup (https://getkirby.com/docs/reference/system/options/url). Well, this messes up Dreamform.

@tobimori
Copy link
Owner

Yeah, I noticed the documentation, I was just curious.

The issue is the plugin can't really work without this, you do have to "validate" the URL somehow. I can't send a "relative" redirect, the Referer always has to be a full URL. If I allow any URLs if / is set, it could be abused (you could use the forms from my site on your site).

@tobimori
Copy link
Owner

Do you use the API submission mode when building headless?

@lemmon
Copy link
Author

lemmon commented Nov 25, 2024

Yeah, I get that there needs to be some kind of protection. Perhaps it could use HTTP_HOST when $site->host() is not present. Should match HTTP_REFERER with such cases.

Think is that the [almost] whole site is headless but forms get embedded into iframes. This is related to #104. Therefore the forms need to work as a regular Kirby. It's kind of a mixed situation.

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

2 participants