Seafdav - MOVE command causing 502

I’m trying to implement the selected solution here in Nginx Proxy Manager gui. Can someone help?

I tried this but doesn’t seem to be correct:
Add a custom location of /seafdav, with the ip pointing to the address and port of the regular seafile server (or do you use the webdav port?).

Then i click the gear to add the custom code:

proxy_set_header Destination "http:$nossl_destination";

THen I go to the Advanced tab to add the “outside server context” content:

map $http_destination $nossl_destination {
"~^https:(.+)$" $1;
"~^http:(.+)$" $1;
}

Does that make sense? Obviously, it doesn’t work. But how else to do it?

Solved 502 error for nginx proxy manager, you need expose seafdav port to local port e.g. 8080 → 20080
/drive replace with your config line

  location /seafile { 
            proxy_pass http://docker-host-ip:exposed-port;
            proxy_http_version 1.1;
            proxy_set_header HOST $host;
            #proxy_set_header Connection "upgrade";
            proxy_set_header X-NginX-Proxy true;
            proxy_buffering off;
            client_max_body_size 0;
            proxy_request_buffering off;
            set $dest $http_destination;
            if ($http_destination ~ "^https://domain/seafile/(.+)") {
                    set $dest /seafile/$1;
            }
            proxy_set_header DESTINATION $dest;
    }

Works well, but there’s other problem. When copy/moving images (jpg) to cloud, it rejects with error



Облако

<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />

<meta http-equiv="x-ua-compatible" content="ie=edge" />
<link rel="icon" href="/media/custom/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/media/favicons/favicon.png">

<link rel="stylesheet" type="text/css" href="/media/assets/css/bootstrap.min.b00faad199b5.css"/>

<link rel="stylesheet" type="text/css" href="/media/css/seahub.css?t=1398068110" />
<link rel="stylesheet" type="text/css" href="/media/css/sf_font3/iconfont.css" />

 

</head>

<body>
    <div id="wrapper" class="en d-flex fd-col h100">
        
        
        

        <div id="header" class="d-flex">
            <a href="/" id="logo">
                <img src="/media/custom/mylogo.png" title="Облако" alt="logo" width="" height="32" />
            </a>
            <span class="sf2-icon-menu side-nav-toggle hidden-md-up hide" title="Side Nav Menu" id="js-toggle-side-nav" aria-label="Side Nav Menu"></span>

            
            
            
            <div id="lang">
                <a href="#" id="lang-context" data-lang="en">English <span class="icon-caret-down"></span></a>
                <div id="lang-context-selector" class="sf-popover hide">
                    <ul class="sf-popover-con">
                        
                        <li><a href="/i18n/?lang=ca">Català</a></li>
                        
                        <li><a href="/i18n/?lang=cs">Čeština</a></li>
                        
                        <li><a href="/i18n/?lang=de">Deutsch</a></li>
                        
                        <li><a href="/i18n/?lang=en">English</a></li>
                        
                        <li><a href="/i18n/?lang=es">Español</a></li>
                        
                        <li><a href="/i18n/?lang=es-ar">Español de Argentina</a></li>
                        
                        <li><a href="/i18n/?lang=es-mx">Español de México</a></li>
                        
                        <li><a href="/i18n/?lang=fr">Français</a></li>
                        
                        <li><a href="/i18n/?lang=it">Italiano</a></li>
                        
                        <li><a href="/i18n/?lang=is">Íslenska</a></li>
                        
                        <li><a href="/i18n/?lang=lv">Latvian</a></li>
                        
                        <li><a href="/i18n/?lang=hu">Magyar</a></li>
                        
                        <li><a href="/i18n/?lang=nl">Nederlands</a></li>
                        
                        <li><a href="/i18n/?lang=pl">Polski</a></li>
                        
                        <li><a href="/i18n/?lang=pt-br">Portuguese, Brazil</a></li>
                        
                        <li><a href="/i18n/?lang=ru">Русский</a></li>
                        
                        <li><a href="/i18n/?lang=sl">Slovenian</a></li>
                        
                        <li><a href="/i18n/?lang=fi">Suomi</a></li>
                        
                        <li><a href="/i18n/?lang=sv">Svenska</a></li>
                        
                        <li><a href="/i18n/?lang=vi">Tiếng Việt</a></li>
                        
                        <li><a href="/i18n/?lang=tr">Türkçe</a></li>
                        
                        <li><a href="/i18n/?lang=uk">українська мова</a></li>
                        
                        <li><a href="/i18n/?lang=he">עברית</a></li>
                        
                        <li><a href="/i18n/?lang=ar">العربية</a></li>
                        
                        <li><a href="/i18n/?lang=el">ελληνικά</a></li>
                        
                        <li><a href="/i18n/?lang=th">ไทย</a></li>
                        
                        <li><a href="/i18n/?lang=ko">한국어</a></li>
                        
                        <li><a href="/i18n/?lang=ja">日本語</a></li>
                        
                        <li><a href="/i18n/?lang=zh-cn">简体中文</a></li>
                        
                        <li><a href="/i18n/?lang=zh-tw">繁體中文</a></li>
                        
                    </ul>
                </div>
            </div>
            
            
        </div>

        <div id="main" class="container-fluid w100 flex-auto ov-auto">
            
            <div class="row">
                <div id="main-panel" class="w100 ovhd">
                    
<div class="text-panel">
  <p>Sorry, but the requested page could not be found.</p>
</div>

                </div>
            </div>
            
        </div>

        

        <div id="confirm-popup" class="hide">
            <div id="confirm-con"></div>
            <button id="confirm-yes">Yes</button>
            <button class="simplemodal-close">No</button>
        </div>
</div><!-- wrapper -->
<script type="text/javascript">
var SEAFILE_GLOBAL = {
    csrfCookieName: 'sfcsrftoken'
};
var app = {
    ui : {
        currentDropdown: false,
        currentHighlightedItem: false,
        freezeItemHightlight: false
    }
}
</script>
<script type="text/javascript" src="/media/assets/scripts/lib/jquery.min.dc5e7f18c8d3.js" id="jquery"></script>
<script type="text/javascript" src="/media/assets/scripts/lib/jquery.simplemodal.55150926fcd1.js"></script>
<script type="text/javascript" src="/media/js/jq.min.js"></script>
<script type="text/javascript" src="/media/js/base.js?t=1536127546642"></script>
<script type="text/javascript">
function prepareAjaxErrorMsg(xhr) {
    var error_msg;
    if (xhr.responseText) {
        var parsed_resp = JSON.parse(xhr.responseText);
        // use `HTMLescape` for msgs which contain variable like 'path'
        error_msg = HTMLescape(parsed_resp.error ||
                parsed_resp.error_msg || parsed_resp.detail);
    } else {
        error_msg = gettext("Failed. Please check the network.");
    }
    return error_msg;
}
function ajaxErrorHandler(xhr, textStatus, errorThrown) {
    var error_msg = prepareAjaxErrorMsg(xhr);
    feedback(error_msg, 'error');
}
 
(function() {
    var lang_context = $('#lang-context'),
        lang_selector = $('#lang-context-selector');

    // for pages without '#lang', such as 'help' pages
    if ($('#lang').length == 0) {
        return;
    }

    lang_context.parent().css({'position':'relative'});

    if ($('#header').is(':visible')) { // for login page
        lang_selector.css({
            'top': lang_context.position().top + lang_context.height() + 5,
            'right': 0
        });
    }

    var setLangSelectorMaxHeight = function() {
        if ($('#header').is(':visible')) { // for login page
            $('.sf-popover-con', lang_selector).css({
                'max-height': $(window).height() - lang_selector.offset().top - 12
            });
        }
    };
    $(window).on('resize', function() {
        if (lang_selector.is(':visible')) {
            setLangSelectorMaxHeight();
        }
    });

    lang_context.on('click', function() {
        lang_selector.toggleClass('hide');
        if (lang_selector.is(':visible')) {
            setLangSelectorMaxHeight();
        }
        return false;
    });

    $(document).on('click', function(e) {
        var element = e.target || e.srcElement;
        if (element.id != 'lang-context-selector' && element.id != 'lang-context') {
            lang_selector.addClass('hide');
        }
    });
})();


if ($('.side-nav').length) {
    $('#logo').addClass('hidden-sm-down');
    $('#js-toggle-side-nav').removeClass('hide');
}
$('#js-toggle-side-nav').on('click', function() {
    $('.side-nav').addClass('side-nav-shown');
    $('').modal({
        overlayClose: true,
        onClose: function() {
            $('.side-nav').removeClass('side-nav-shown');
            $.modal.close();
        }});
    $('#simplemodal-container').css({'display':'none'});
    return false;
});
$('.js-close-side-nav').on('click', function() {
    $('.side-nav').removeClass('side-nav-shown');
    return false;
});
</script>

</body>
</html>

Thank you for showing a picture of NPM. I’ve been scouring the web trying to find pictures ofhow to use the location with the advanced configs. I’m essentially using the instructions in the seafile documentations.

Now, webdav works for the most part. But I get 502 errors with certain things like swift backup on android, so same issue as you. I don’t understand the point of the local port and the drive thing, but I tried that and it also worked except for the 502. Now I will try the if statement you’ve added.

I cannot get mcking’s config to work for me. In the “solution” post, my question is what does "outside the server context’ mean for nginx proxy manager? I have no idea where to place that code. I know understand how the location setting works and I have that working I feel. But those two lines for outside the server i have no idea what to do with. And can anyone from seafile explain or instruct?

Try to disable cache assets and it will work

I never had cache assets enabled. I tried enabled and disabled, still get the 502 error.
So far, the only thing I have added to my config as far as advanced stuff is the location block from the official documentation. So nobody has gotten this to work with Nginx Proxy Manager?

Hey guess what, I solved my own problem. Here is the description.

So if you read NPM documentation it mentions: Advanced Configuration | Nginx Proxy Manager

It mentions all these files you can add to further tweak nginx. So which is outside server block? I used the one called http_top.conf

I just pasted the relevant stuff in there, and it worked!!!

So there you go. That’s how you do a complex advanced config with NPM gui.

Now, this was running on docker, so i had to do an apt update and install nano, and then create the custom folder and the file named above first, before editing the file.

As for what I pasted, I just used the stuff in the marked solution, exactly the way it is.

Thanks, that worked for me.

After upgrading to Seafile Community 10, simply removing all non-standard configuration (including the “Destionation” fix) fixed all issues I had with SeafDav.

oh great! thanks for this hint. Would have been awesome if the documentation contained this hint. I didn’t read the thread until the end and started adding all the header stuff just to read that it’s not needed anymore.
Can confirm it’s working with SeaFile 10 without the destination workaround. I have just created a pull request for the documentation as well.