QueraTeam / django-nextjs

Next.js integration for Django projects
MIT License
341 stars 17 forks source link

Include client's User-Agent header in requests to NextJS server from NextJSProxyView #33

Closed Lizards closed 2 months ago

Lizards commented 2 months ago

This includes the end user's User-Agent header value in requests to the NextJS server from the NextJSProxyView development proxy.

We ran into an issue with using req.headers['user-agent'] in getServerSideProps to vary API calls between desktop and mobile clients. The User-Agent value was from the Django server, Python-urllib/3.8. (Note that our issue appears fixed after converting from the Pages Router to the App Router, but this could be useful for apps that have not yet converted to App Router.)

danialkeimasi commented 2 months ago

Thank you for your contribution!