Support » Plugin: Multiple Domain » Images not loading under the newly added domain

  • Resolved basti2631

    (@basti2631)


    Hi,

    we have just installed the plugin and with the url handling everything looks good, we can navigate on the WP with both of them.
    The problem is that the images are not loading under the newly added domanin (non-default) “pannonbajor.hu” only with “bayernszektor.hu” (default).
    In this moment – as I am writing the comment – the new domain is still not configured with ssl. Not sure if that might be the cause??
    Tried to activate the canonical links as well – without any success.

    Could you please advise?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Gustavo Straube

    (@gustavostraube)

    Hello,

    It seems there is some restriction in place on your server. By any chance, do you have a rule or something to avoid other sites to add your images to them? I’m supposing that because, when opening the image in a new tab, it works perfectly. It only breaks when loading from the page. I guess there is a rule somewhere, in the Apache’s .htaccess file (manually added or automatically by some plugin) or even in a lower level (imposed by your hosting service) that blocks those requests. It only happens when the referrer is different than bayernszektor.hu.

    Following, there are two simple cURL requests to reproduce the issue.

    With https://bayernszektor.hu/ as the referrer:

    curl 'https://pannonbajor.hu/wp-content/uploads/2020/07/die-meisterschale-sie-wird-in-der-saison-2020-2021-spaetestens-am-22-mai-vergeben--450x270.jpg' \
        -H 'referer: https://bayernszektor.hu/' \
        -vvv -s \
        --insecure \
        --output 'output.jpg'

    The response comes with these headers, which is the expected:

    < HTTP/2 200 
    < date: Sun, 12 Jul 2020 14:49:03 GMT
    < server: Apache
    < last-modified: Sat, 11 Jul 2020 07:57:44 GMT
    < etag: "84d5-5aa25d00f8c4b"
    < accept-ranges: bytes
    < content-length: 34005
    < cache-control: max-age=31536000
    < expires: Mon, 12 Jul 2021 14:49:03 GMT
    < referrer-policy: same-origin
    < content-type: image/jpeg

    However, when having https://pannonbajor.hu/ in the referrer header:

    curl 'https://pannonbajor.hu/wp-content/uploads/2020/07/die-meisterschale-sie-wird-in-der-saison-2020-2021-spaetestens-am-22-mai-vergeben--450x270.jpg' \
        -H 'referer: https://pannonbajor.hu/' \
        -vvv -s \
        --insecure \
        --output 'output.jpg'

    The response headers look like this — notice its outputting HTML, instead of JPEG type:

    < HTTP/2 404 
    < date: Sun, 12 Jul 2020 14:51:22 GMT
    < server: Apache
    < x-powered-by: PHP/7.3.19
    < expires: Wed, 11 Jan 1984 05:00:00 GMT
    < cache-control: no-cache, must-revalidate, max-age=0
    < link: <https://pannonbajor.hu/wp-json/>; rel="https://api.w.org/"
    < vary: Accept-Encoding,User-Agent
    < referrer-policy: same-origin
    < content-type: text/html; charset=UTF-8

    Let me know if those details help.

    Regards

    Thread Starter basti2631

    (@basti2631)

    You are the best, Gustavo!
    We did really have a condition rule in the .htaccess file which allowed the hotlinking only for the primary domain. We had to insert a row for the second domain as well

    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$
    RewriteCond %{HTTP_REFERER} !^http(s)?://bayernszektor\.hu [NC,OR]
    RewriteCond %{HTTP_REFERER} !^http(s)?://pannonbajor\.hu [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^$

    Actually, we had to do this not only in the root folder but the wp-uploads folders since that also contained a .htaccess file with the same restriction.

    Again, thank you very much for the amazing support (super quick and effective)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Images not loading under the newly added domain’ is closed to new replies.