Ubuntu Varnish mobile detection results in to page

2019-08-17 03:42发布

问题:

I am trying this example to do mobile device detection using varnish https://github.com/varnish/varnish-devicedetect/blob/master/INSTALL.rst

I implemented Example 1 and now trying to test it via the testing tools at the bottom https://github.com/varnish/varnish-devicedetect/blob/master/INSTALL.rst#testing-tools

I am unsure how to work this part, it gives me Page not Found

Now you can access it through:

http://localhost:5911/devicetest/ , or
http://localhost:6081/devicetest/ # Change 6081 into your Varnish listening port.

For the backend example I am using port no 5912, which I updated in the devicedetect-dev.vcl file and backend/example-backend.py file.

When I do mywebsiteaddress:5912/set_ua_device/ , I get a Page not found error. I am unsure what I am missing in this case?

I also tried Example 3 install and it works fine for me. Although I would prefer to enable the device detection via Example 1. I am trying this on ubuntu AWS server.

Update: After restarting both the apache and varnish. I can now achieve step1 of testing-tools and a cookie is being set. Although mywebsiteaddress:5912/set_ua_device/ still results in a 404 Page not found

Not sure what I am missing here. Thanks.

回答1:

for people coming on this page searching how to serve for different devices using varnish . other than varnish-devicedetect you can also try a different solution .

try this tutorial from atomic object

they follow a very simple approach and all you need to do is add few vcl rules, suited for noobs like me