a1rpun/microsoft-links-refresh

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

Fixes redirects to login pages when a user clicks a link to your site from a Microsoft application like Word or Excel

dev-master 2019-07-23 22:42 UTC

This package is auto-updated.

Last update: 2020-12-24 02:36:35 UTC


README

Fixes redirects to login pages when a user clicks a link to your site from a Microsoft application

  • Excel
  • Word
  • PowerPoint

Code based on this ruby gem

Explanations

📦 Install

$ composer require a1rpun/microsoft-links-refresh

🔧 Config

config/services.yaml

microsoft_links_refresh:
  class: A1rPun\MicrosoftLinksRefresh
  tags:
    - { name: kernel.event_subscriber }

💪 Example usage

1. Example request object

{
  "headers": {
    "User-Agent": "Excel"
  }
}

2. Response payload (prettified)

<html>
  <head>
    <meta http-equiv="refresh" content="0"/>
  </head>
  <body></body>
</html>

3. What happens next?

The request was discarded initially, now the browser refreshes the page and sends the correct headers like a normal click would do.

Limitations

🐌 As you can see this service slows down page load but gives the user the experience they deserve! Response statistic

❗ The User-Agent can be spoofed in the browser by your local user-agent-switcher extension or any request application like curl or postman.

⁉️ Currently uses RegEx to parse the User-Agent, may be vulnarable to a ReDos by malicious users.

📃 License

MIT, see LICENSE.