Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom user-agent #7

Open
dannyhajj opened this issue Feb 1, 2019 · 5 comments · Fixed by #12
Open

Add a custom user-agent #7

dannyhajj opened this issue Feb 1, 2019 · 5 comments · Fixed by #12

Comments

@dannyhajj
Copy link
Collaborator

The cache warmer needs to send a proper and custom User-Agent so access logs on web servers can log the info properly and make it easier for sysadmins to know what's happening.

@sys0dm1n
Copy link
Owner

sys0dm1n commented Feb 1, 2019

This is already implemented, correct me if I am wrong: https://curl.haxx.se/docs/manpage.html#-A
Thank you :-)

@dannyhajj
Copy link
Collaborator Author

dannyhajj commented Feb 1, 2019

I see. The User Agent is being sent in the curl commands. But the wget commands aren't sending the User-Agent.
Though I would recommend adding more details to it. Like the following User-Agent string:

VarnishCacheWarmer/1.0.0 (For more details visit https://github.com/sys0dm1n/varnish-cache-warmer)

dannyhajj pushed a commit that referenced this issue Feb 7, 2019
This resolves #7 by using a User-Agent string that follows
the standard format defined in rfc7231.

Currently using the following:
Product/Version (Comment)
@sys0dm1n sys0dm1n reopened this Feb 7, 2019
@sys0dm1n
Copy link
Owner

sys0dm1n commented Feb 7, 2019

Prompt user for custom user-agent else use default value

@dannyhajj
Copy link
Collaborator Author

I'm not sure it's a good idea to allow changing the User-Agent. Not by default at least since anyone can still edit the code and modify it.

But the idea of the user agent here is to allow a sysadmin to see what's going on when checking their access logs. And I added the link to this repo as a comment value so they can reach this repo and see what it is about.

Especially since anyone can use this to maliciously crawl a site.

@sys0dm1n
Copy link
Owner

sys0dm1n commented Feb 7, 2019

I still think it could be a cool feature in cases where you want to run the script from different places at the same time.

We can always append the repo's URL to the custom user-agent !

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants