mardi 14 février 2017

Routing doesn't work properly when URL clicked in Word or Excel (PHP, Laravel)

We have an application running on PHP 5.5 & Laravel 5.2. It has a user account area, in which all routes are prefixed by /account/. The default route for the account area is /account/services. Users are routed to this page by default after login.

Of course, if a user enters a specific account area URL such as http://ift.tt/2kFevs0, they are taken to the billing page upon login (or directly, if already authenticated).

However, if I click http://ift.tt/2km0JyG in Excel or Word, I go to the default /account/services page (if authenticated; otherwise I go there after logging in).

At first I believed this was because they are inserting hidden character(s) and thus invalidating the URL, causing our application to route the user to the default URL.

So I tried these solutions:

  • trim() the URL
  • Removing nonbreaking spaces: $url = preg_replace('~\x{00a0}~','',$reqURL);
  • function to remove byte order mark (sourced here)

I've even copied test URLs from the browser into NPP and viewed as hex. There don't appear to be any extra characters.

If I manually type the same URL into the browser bar, everything works perfectly.

This is only happening for URLs which require authentication, public / frontend URLs seem unaffected. This lead me to this answer, but I don't believe it applies in our case. Microsoft is indeed running Microsoft Office Protocol Discovery before opening these URLs in the browser, but our authentication cookie being recognized.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2laGqE4
via IFTTT

Aucun commentaire:

Enregistrer un commentaire