Quantcast
Channel: URL Rewrite based on User-Agent header - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by tim for URL Rewrite based on User-Agent header

$
0
0

For anyone still looking for a solution to this: Here is how I currently check whether a user agent is from facebook:

const agent = request.headers["user-agent"]if (agent.toLowerCase().includes("facebook"))    response.send(<payload>)else    response.redirect(<path-to-index.html>)

The request / response variables are the ones, received through functions.https.onRequest((request, response) => { ... }). For more information, check the Firebase Docs and Express Docs.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>