Why are cookies unrecognized when a link is clicked from an external source (i.e. Excel, Word, etc…)

后端 未结 17 2545
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 04:39

I noticed that when a link is clicked externally from the web browser, such as from Excel or Word, that my session cookie is initially unrecognized, even if the link opens u

17条回答
  •  感情败类
    2020-11-28 04:56

    I can't believe they call this a feature. However, here's a featurefix for Apache:

    RewriteEngine On
    
    # Send a 200 to MS Office so it just hands over control to the browser
    # It does not use existing session cookies and would be redirected to the login page otherwise
    # https://www.wimpyprogrammer.com/microsoft-office-link-pre-fetching-and-single-sign-on/
    
    RewriteCond %{HTTP_USER_AGENT} ;\sms-office(\)|;)
    RewriteRule .* - [R=200,L]
    

    Might not be best performance wise, as the whole page gets sent instead of an empty response, but I did not want to add another Apache modules just for fixing such an idio^H^H^H^H feature.

提交回复
热议问题