• Resolved Keith

    (@keithkhl)


    I have the PDF file on the same domain.

    Then, I get following error msg

    • Failed to fetch Error: URL to the PDF file must be on exactly the same domain as the current web page

    I clicked to the designated link, but it only says things related to www or not. I do not use www for all my domains.

    This happens to all my subsites on a single multisite. I have also tried with network activation, but it doesn’t work neither.

    Is this because of multisite incompatibility? If so, I thought at least it should work on multisite’s 1st site, but it didn’t work.

    • This topic was modified 9 months, 1 week ago by Keith.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi, @keithkhl!
    Thanks for contacting us!

    Our Knowledge Base has information regarding this. You can check it at: https://wp-pdf.com/kb/#faq-28818

    The “www” is important – it references a different domain to the PDF’s URL that does not contain “www”.

    For security reasons, browsers are not allowed to load the PDF from a different domain.

    Let’s say your site is available via both https://www.mycompany.com and mycompany.com. Then that’s an inconsistency that is also confusing to search engines and users.

    To fix this, ask your web hosting company to make it consistent – for example, to redirect users direct from https://www.mycompany.com to mycompany.com, so everyone is using the same domain.

    Then, you will need to ensure all your [pdf-embedder] shortcodes refer to the PDF’s URL in the new preferred manner.

    I hope it helps! Can you please give it a try and let me know how it goes?

    Thanks, and have a good one!

    Thread Starter Keith

    (@keithkhl)

    I do not have ‘www’ in the url, and that is not defined in my server/dns. In fact, the same issue occurs for subdomains w/ sub.example.com in a subsite in my multisite.

    It worked fine when I had single site, but immediately after I combined my websites to a multisite, it no longer works.

    I am only fishing here, but I wonder if it is due to multisite imcompatibility.

    Hi, @keithkhl.

    Can you please share with us your site URL?

    If you are not comfortable sharing it publicly, please contact us at?wp-pdf.com/contact/, and we will continue the investigation via email.

    Thanks!

    Thread Starter Keith

    (@keithkhl)

    Did so via Pre-Sale or Basic Question, since I am not on paid version.

    I hope the problem is resolved soon.

    harchvertelol

    (@harchvertelol)

    I have got a similar error after the last plugin update. Before this, everything worked stably for 2 years. I didn’t change anything in the tags.

    harchvertelol

    (@harchvertelol)

    I rolled back to the previous version 4.6.4 and everything works. Please fix the new version. Thank you!

    P. S. All files in same domain (not multi-site).

    harchvertelol

    (@harchvertelol)

    Example (working on 4.6.4 and not work on 4.7.1):

    [pdf-embedder url=’../gm-data/webinars/6/FB/Занятие 5/ДЗ-05 Решения.pdf’]

    harchvertelol

    (@harchvertelol)

    It helped me to modify the code for getting the tag like this:

    return “[pdf-embedder url='”.get_site_url().”/gm-data/webinars/”.$file_src.”‘]”;

    Tag:

    [pdf-embedder url=’https://mysite.com/gm-data/webinars/6/FB/Занятие 5/ДЗ-05 Решения.pdf’]

    But I wouldn’t want to do that. Is it possible to correct the plugin code so that the tag works in the form indicated above (with ../)?

    Plugin Author Slava Abakumov

    (@slaffik)

    Hey @harchvertelol,

    I think you have a different problem, so it would be better if you created a separate forum thread. But I will reply here (sorry, Keith, for getting pinged with unrelated discussion).

    No, we will not modify it back, because the way you want it to work is vulnerable to path traversing. This is basically a security vulnerability we fixed in 4.7.0, hence this record in our changelog:

    • Fixed: Several security related improvements have been introduced (data sanitization and escaping).

    So I would highly recommend you use the latest version of the plugin, and install some search-replace plugins or use the wp-cli command to set the correct URL for all shortcodes in one go.

    The correct url should be either of these examples:

    1. https://mysite.com/gm-data/webinars/6/FB/Занятие 5/ДЗ-05 Решения.pdf
    2. /gm-data/webinars/6/FB/Занятие 5/ДЗ-05 Решения.pdf – but if I understood your code correctly, you have WP installed in one directory and files (gm-data) are located in a different location – not under the WP-root directory.

    Note the leading / in the 2nd example – this means “start the URL searching from the root of the domain”. But I would highly recommend to set the URL to use the full URL (with the https://mysite.com – to avoid any other potential issues in the future).

    harchvertelol

    (@harchvertelol)

    Thank you for you answer!

    Thread Starter Keith

    (@keithkhl)

    Any progress? @ecapella and @slaffik

    I am also wondering if earlier version can at least temporarily solve my problem. One of the key features of my websites have been disabled and I certainly do have increasing number of dissatisfied customers.

    Thread Starter Keith

    (@keithkhl)

    I fixed it. ?@ecapella?and?@slaffik

    Was due to nginx configuration that I added *.PDF for privacy protection.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Failed to fetch Error: URL to the PDF file must be on exactly the same domain as’ is closed to new replies.