callback url 308 error

Created on 18 May 2023, over 1 year ago
Updated 1 December 2023, 12 months ago

Problem/Motivation

I have connected the Drupal instance to the OnlyOffice instance, and files successfully open in onlyoffice, however OnlyOffice cannot save the file back to Drupal. OnlyOffice reports the following error:


[2023-05-18T20:42:28.277] [ERROR] [localhost] [ce84480b-3450-400b-924e-ad31a3550fd8_MTY4NDQ0MjM0Mg==] [11] nodeJS - sendServerRequest error: url = http://REDACTED/onlyoffice-callback/aDFYQlkyY0dTZDU4R0pRYVJ0aGw4NU5vaUxZUTREdXZiNUtJMWs3RFFGND83YTU0NDg0MS1mNjZmLTQ4N2QtODU5YS03YTBjOTNlODQ2MDE;data = {"key":"ce84480b-3450-400b-924e-ad31a3550fd8_MTY4NDQ0MjM0Mg==","status":2,"url":"https://REDACTED.preview.app.github.dev/cache/files/data/ce84480b-3450-400b-924e-ad31a3550fd8_MTY4NDQ0MjM0Mg==_7578/output.docx/output.docx?md5=KT9Z7vhQqVMEKYxkgJDMMA&expires=1684443449&filename=output.docx","history":{},"users":["1"],"actions":[{"type":0,"userid":"1"}],"lastsave":"2023-05-18T20:41:37.000Z","notmodified":false,"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJjZTg0NDgwYi0zNDUwLTQwMGItOTI0ZS1hZDMxYTM1NTBmZDhfTVRZNE5EUTBNak0wTWc9PSIsInN0YXR1cyI6MiwidXJsIjoiaHR0cHM6Ly9rZWxpem9saXZhLWNhdXRpb3VzLWJyb2Njb2xpLXZxcHA1NHE2NXh3Znc3cC04MC5wcmV2aWV3LmFwcC5naXRodWIuZGV2L2NhY2hlL2ZpbGVzL2RhdGEvY2U4NDQ4MGItMzQ1MC00MDBiLTkyNGUtYWQzMWEzNTUwZmQ4X01UWTRORFEwTWpNME1nPT1fNzU3OC9vdXRwdXQuZG9jeC9vdXRwdXQuZG9jeD9tZDU9S1Q5Wjd2aFFxVk1FS1l4a2dKRE1NQSZleHBpcmVzPTE2ODQ0NDM0NDkmZmlsZW5hbWU9b3V0cHV0LmRvY3giLCJoaXN0b3J5Ijp7fSwidXNlcnMiOlsiMSJdLCJhY3Rpb25zIjpbeyJ0eXBlIjowLCJ1c2VyaWQiOiIxIn1dLCJsYXN0c2F2ZSI6IjIwMjMtMDUtMThUMjA6NDE6MzcuMDAwWiIsIm5vdG1vZGlmaWVkIjpmYWxzZSwiZmlsZXR5cGUiOiJkb2N4IiwiaWF0IjoxNjg0NDQyNTQ4LCJleHAiOjE2ODQ0NDI4NDh9.w-FyeHmMFlMup7uNEp2zn-WAg2WUf1w-fOjpwfR1jjI","filetype":"docx"} Error: Error response: statusCode:308; headers:{"date":"Thu, 18 May 2023 20:42:28 GMT","content-type":"text/html","content-length":"164","connection":"keep-alive","location":"https://REDACTED/onlyoffice-callback/aDFYQlkyY0dTZDU4R0pRYVJ0aGw4NU5vaUxZUTREdXZiNUtJMWs3RFFGND83YTU0NDg0MS1mNjZmLTQ4N2QtODU5YS03YTBjOTNlODQ2MDE"}; body:<html>^M
<head><title>308 Permanent Redirect</title></head>^M
<body>^M
<center><h1>308 Permanent Redirect</h1></center>^M
<hr><center>nginx</center>^M
</body>^M
</html>^M

    at Request._callback (/snapshot/server/build/server/Common/sources/utils.js)
    at Request.callback (/snapshot/server/build/server/Common/node_modules/request/request.js:185:22)
    at Request.emit (events.js:400:28)
    at Request.<anonymous> (/snapshot/server/build/server/Common/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:400:28)
    at IncomingMessage.<anonymous> (/snapshot/server/build/server/Common/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:519:28)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1333:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

I see that there is a 308 Permanent Redirect, but I also see in the config that that Drupal is sending :

Generated config for media document REDACTED.docx:
Array
(
    [type] => desktop
    [width] => 100%
    [height] => 100%
    [documentType] => word
    [document] => Array
        (
            [title] => REDACTED.docx
            [url] => http://REDACTED/onlyoffice-download/MmpJeVlXRUlEOU1wOWNOT3BJXzE4RUl0b2p3TDBFUklxRDVNeXMtR0wtdz9jZTg0NDgwYi0zNDUwLTQwMGItOTI0ZS1hZDMxYTM1NTBmZDg_MQ
            [fileType] => docx
            [key] => ce84480b-3450-400b-924e-ad31a3550fd8_MTY4NDQ0MjM0Mg==
            [info] => Array
                (
                    [owner] => REDACTED
                    [uploaded] => 05/18/2023 - 16:38
                )

            [permissions] => Array
                (
                    [download] => 1
                    [edit] => 1
                )

        )

    [editorConfig] => Array
        (
            [callbackUrl] => http://REDACTED/onlyoffice-callback/aDFYQlkyY0dTZDU4R0pRYVJ0aGw4NU5vaUxZUTREdXZiNUtJMWs3RFFGND83YTU0NDg0MS1mNjZmLTQ4N2QtODU5YS03YTBjOTNlODQ2MDE
            [mode] => edit
            [lang] => en
            [user] => Array
                (
                    [id] => 1
                    [name] => cealAdmin
                )

            [customization] => Array
                (
                    [goback] => Array
                        (
                            [url] => http://REDACTED/admin/content/media
                        )

                )

        )

    [token] => eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiZGVza3RvcCIsIndpZHRoIjoiMTAwJSIsImhlaWdodCI6IjEwMCUiLCJkb2N1bWVudFR5cGUiOiJ3b3JkIiwiZG9jdW1lbnQiOnsidGl0bGUiOiJDRVRBQyBDb2xsYWJvcmF0aW9uIFBvcnRhbCAtIHJlYWwtdGltZSBjb2xsYWJvcmF0aW9uLmRvY3giLCJ1cmwiOiJodHRwOlwvXC9kZW1vLWNlYWxhbGxpYW5jZS53ZXNkZW1vLmNvbVwvb25seW9mZmljZS1kb3dubG9hZFwvTW1wSmVWbFhSVWxFT1Uxd09XTk9UM0JKWHpFNFJVbDBiMnAzVERCRlVrbHhSRFZOZVhNdFIwd3RkejlqWlRnME5EZ3dZaTB6TkRVd0xUUXdNR0l0T1RJMFpTMWhaRE14WVRNMU5UQm1aRGdfTVEiLCJmaWxlVHlwZSI6ImRvY3giLCJrZXkiOiJjZTg0NDgwYi0zNDUwLTQwMGItOTI0ZS1hZDMxYTM1NTBmZDhfTVRZNE5EUTBNak0wTWc9PSIsImluZm8iOnsib3duZXIiOiJjZWFsQWRtaW4iLCJ1cGxvYWRlZCI6IjA1XC8xOFwvMjAyMyAtIDE2OjM4In0sInBlcm1pc3Npb25zIjp7ImRvd25sb2FkIjp0cnVlLCJlZGl0Ijp0cnVlfX0sImVkaXRvckNvbmZpZyI6eyJjYWxsYmFja1VybCI6Imh0dHA6XC9cL2RlbW8tY2VhbGFsbGlhbmNlLndlc2RlbW8uY29tXC9vbmx5b2ZmaWNlLWNhbGxiYWNrXC9hREZZUWxreVkwZFRaRFU0UjBwUllWSjBhR3c0TlU1dmFVeFpVVFJFZFhaaU5VdEpNV3MzUkZGR05EODNZVFUwTkRnME1TMW1OalptTFRRNE4yUXRPRFU1WVMwM1lUQmpPVE5sT0RRMk1ERSIsIm1vZGUiOiJlZGl0IiwibGFuZyI6ImVuIiwidXNlciI6eyJpZCI6IjEiLCJuYW1lIjoiY2VhbEFkbWluIn0sImN1c3RvbWl6YXRpb24iOnsiZ29iYWNrIjp7InVybCI6Imh0dHA6XC9cL2RlbW8tY2VhbGFsbGlhbmNlLndlc2RlbW8uY29tXC9hZG1pblwvY29udGVudFwvbWVkaWEifX19fQ.622OZV8dUShwShs6LNBvJsuSeBPM-mermzynfLFYOgE
)

I see that the callback url being sent to only office is http, not https. This seems incorrect, and I'm not sure how to address that, but I also don't know if that is the extent of the issue.

Curious if there is a way to force the callback url to use https rather than http.

I'm not sure what other details to provide that would be helpful, but any ideas of anything I should check would be really appreciated!

Other details:
ONLYOFFICE Docker DocumentServer v7.4.0.113
Drupal 9.5.8
Drupal site is running in a kubernetes container, using nginx reverse proxy serving the site on port 443. Apache is serving the site on port 80 from the drupal container to nginx, Reverse proxy settings in settings.config are:

$settings['reverse_proxy'] = TRUE; 
$settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
$settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;
πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States k.elizabeth

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @k.elizabeth
  • πŸ‡ΊπŸ‡ΈUnited States k.elizabeth
  • πŸ‡ΊπŸ‡ΈUnited States k.elizabeth
  • Hi k.elizabeth β†’ ,
    you must specify the following in your settings.php file:

    $settings['reverse_proxy'] = TRUE;
    $settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
    

    This issue is described here:
    https://www.drupal.org/project/metatag/issues/2842049 πŸ“Œ urls with http instead of https Needs review

  • πŸ‡ΊπŸ‡ΈUnited States k.elizabeth

    Yes, this issue exists with the following settings in settings.php:

    $settings['reverse_proxy'] = TRUE;
    $settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
    $settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;
    

    This is also all cross-checked against phpinfo:

    HTTP Request	GET /admin/reports/status/php HTTP/1.1
    Host	REDACTED.com
    X-Request-ID	3a240d7e5df3deb587dc3a1874b64a4e
    X-Real-IP	REDACTED
    X-Forwarded-For	REDACTED
    X-Forwarded-Host	REDACTED.com
    X-Forwarded-Port	443
    X-Forwarded-Proto	https
    X-Forwarded-Scheme	https
    X-Scheme	https

    For this we ended up patching the module to rewrite the formation of the urls, where we hardcode the scheme to https.

    I think this issue is more at the drupal core level than the module level, so this may be closed. Though an option (like a checkbox on the settings page) to enforce the preferred scheme in the module would be helpful.

  • Status changed to Closed: outdated 12 months ago
Production build 0.71.5 2024