a1rpun / microsoft-links-refresh
Fixes redirects to login pages when a user clicks a link to your site from a Microsoft application like Word or Excel
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:package
Requires
- symfony/http-kernel: ~2.3|~3.0|~4.0
Requires (Dev)
- phpunit/phpunit: ^8
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
- The cause (support.microsoft)
- The actual cause (Stack Overflow)
- The workaround for clients (docs.microsoft)
- The workaround for server (this package 😉)
📦 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!
❗ 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.