Closed aqlx86 closed 1 year ago
Hello, the user agent response or any other response is not cached. Please use our API without the package if you need an accurate user-agent response, send the request from the browser. (https://apiip.net/documentation)
same result. I skipped the packages
Send the request via the browser, not from the server. We are taking user-agent from the request header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent You can observe that if you send the request via Postman (https://www.postman.com) Or you can check by sending a request directly from the browser (browser's address bar) http://apiip.net/api/check?accessKey={key}
Send the request via the browser, not from the server. We are taking user-agent from the request header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent You can observe that if you send the request via Postman (https://www.postman.com) Or you can check by sending a request directly from the browser (browser's address bar) http://apiip.net/api/check?accessKey={key}
obviously, if you access the API URL directly in the browser it will capture the user-agent, but if you are integrating your API to another API you will need an HTTP client like Axios or fetch, The code snippet I posted above is the same in your examples it is inside of a API controller which is access in browser also.
It is not about axios or fetch, it's about user-agent request header, so you can set it manually if you want, and it will work. You can check it here: https://apiip.net There you can find accurate userAgent response and we are using axios to make the request, but from the frontend side (client side), not from the server side, that is the difference. Any request will automatically attach a user-agent request header, so if you are making it from the backend side, it will capture your backend-server info, but if you are making the request from the client side, the user-agent will be the client's browser, device and OP. Also, you can set user-agent manually, first capturing the client's user-agent with your backend, and then setting the header when sending it to our API. It's up to you how you will implement it.
Why is the response data for the user-agent cached? is there an option to turn this off?
I'm using a desktop browser but the response was from the initial request.