aaemnnosttv / wp-cli-login-command

Log in to WordPress with secure passwordless magic links.
https://aaemnnost.tv/wp-cli-commands/login/
MIT License
300 stars 48 forks source link

Incompatible with trailing slash rewriterule (Apache) #40

Closed rgbkgb closed 1 year ago

rgbkgb commented 3 years ago

Hello, Thanks for your awesome work ! However, the magic link URL is not working properly because we have an apache rewriterule adding a trailing slash, then it leads to a 404. Do you have any idea about how we could mitigate this issue ? Maybe we could change the source code in order to add a trailing slash to your magic link URL ? Thanks in advance for your help !

Arthur

rgbkgb commented 3 years ago

We've added a RewriteCond to our .htaccess in order to not add a trailing slash to the magicUrl, however we are using CloudFlare, and it redirects us to the homepage. We have made extensive testing and this behaviour is related to CloudFlare :/ Since the endpoint could change, it's hard to create a bypass cache rule on CloudFlare side, any ideas ?

elindydotcom commented 2 years ago

@rgbkgb - do you know if this is still an issue with Cloudflare? Was looking at this project as an option to meet a need but Cloudflare is a must. So was just wondering if this is still an issue for you or if you found a workaround inside cloudflare.

jcatello commented 2 years ago

Wanted to bump this, forcing the trailing slash is sometimes necessary because of caching, so it would be good if the URL will work with a trailing slash as well

aaemnnosttv commented 2 years ago

Thanks @jcatello – is the trailing slash applied as a redirect on the web server in that case or filtered into the URL WP generates?

jcatello commented 2 years ago

Its a redirect applied by the webserver, typically for WP Rocket users:

https://docs.wp-rocket.me/article/131-redirection-to-enforce-trailing-slash-on-urls#trailing-slashes-on-nginx-servers

jcatello commented 2 years ago

https://github.com/aaemnnosttv/wp-cli-login-command/pull/58 Do you want to review this?

aaemnnosttv commented 2 years ago

Planning on addressing this soon. Working on updating CI infra first before merging other changes.