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

user-agent header Issue resolved in headless mode #868

Merged

Conversation

michael2to3
Copy link

Issue with Setting User-Agent Header in Headless Mode

I've encountered an issue where setting the User-Agent header in headless mode was not effective, despite specifying it through both -H "User-Agent: 123" and the headless driver option --user-agent=123. The header would not change as expected. Below are the before and after screenshots for clarity:

Before:
This image demonstrates the simultaneous use of both methods, showing that the User-Agent header remained unchanged.
image

After:
This image shows that after my modifications, setting the header using -H "User-Agent: 123" alone is now sufficient to change the User-Agent.
image

Please review these changes. If there are any inaccuracies or if further adjustments are necessary, I'm open to feedback and willing to help enhance this functionality

@GeorginaReeder
Copy link

Thanks for your contribution @michael2to3 , we really appreciate it.

We also have a Discord server, which you’re more than welcome to join. It's a great place to connect with fellow contributors and stay updated with the latest developments!

@dogancanbakir
Copy link
Member

I believe the issue can be resolved by removing this function completely, which overrides the user-agent in a few places

func WebUserAgent() string {
. Removing the function should solve the problem.

@Mzack9999, have we encountered any practical issues that were solved by overriding the user agent with this one?

@michael2to3
Copy link
Author

Yeah that much better

@michael2to3
Copy link
Author

the first part is with headless mode, the second without after deleting the Web User Agent. Will need to remove either only for headless mode, or leave the overwrite in crawl.go
image

@Mzack9999
Copy link
Member

@dogancanbakir I believe the helper function was implemented in a few places to avoid using the go default user agent, which is filtered out in many cases

@ehsandeep ehsandeep merged commit 71683be into projectdiscovery:dev May 13, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants