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

Absolute url / Relative url #163

Open
Gilbertdelyon opened this issue Jan 11, 2023 · 2 comments
Open

Absolute url / Relative url #163

Gilbertdelyon opened this issue Jan 11, 2023 · 2 comments

Comments

@Gilbertdelyon
Copy link

Gilbertdelyon commented Jan 11, 2023

In our site we often use Iframes (custom pages) to display the content of some files (example: tutorial.pdf files )
Files and custom pages are of course stored in the same site.
They are displayed correctly in FFox and Edge, but since a few days they are not displayed correctly in Chrome.
Instead we get an error in the console:
Refused to display '[https:/sitedomain.xy/](https://https/)' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

We dont understand the reason because everything is in the same site.

After some investigation we noticed the following:

  • In Iframe we used the absolute url ( easy and lazzy copy of the url that we get from the "Display Url" popup) .
    https://sitedomain.xy/HH/index.php?r=file%2Ffile%2Fdownload&guid=db4b25e2-57d6-4b69-b811-0a4f9b19a68b
  • should we use instead the relative url
    /HH/index.php?r=file%2Ffile%2Fdownload&guid=db4b25e2-57d6-4b69-b811-0a4f9b19a68b
@luke-
Copy link
Contributor

luke- commented Jan 12, 2023

Hmm, thats strange. An option could be to allow the X-Frame-Options.
https://docs.humhub.org/docs/admin/security#web-security-configuration

@Gilbertdelyon
Copy link
Author

Gilbertdelyon commented Jan 12, 2023

Thanks Luke,
No succes with your advice
But it still works in FFox and Edge
In Chrome it works only if we use relative url.
And in Chrome/Android it doesn't work at all, but this is another story.

So, I built a "PDF Iframe" custom page template with a few lines of javascript that converts the native absolute url into a relative url.

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