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

[BUG] Web: Refused to set unsafe header "User-Agent" #1654

Closed
d1ss0nanz opened this issue Sep 13, 2023 · 4 comments · Fixed by #1677
Closed

[BUG] Web: Refused to set unsafe header "User-Agent" #1654

d1ss0nanz opened this issue Sep 13, 2023 · 4 comments · Fixed by #1677
Labels
bug This issue reports broken functionality or another error P: 3 (low) (Default priority for feature requests)

Comments

@d1ss0nanz
Copy link

What is the bug?

There seems to be a regression in v5 that is trying to set the User-Agent header on web.

How can we reproduce it?

Use flutter_map in web application.

Do you have a potential solution?

No response

Platforms

Flutter Web on Chrome

Severity

Minimum: Allows normal functioning

@d1ss0nanz d1ss0nanz added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Sep 13, 2023
@JaffaKetchup
Copy link
Member

Hey @d1ss0nanz,
We're aware of this, and did this intentionally in order to simplify the code base. This shouldn't cause any issues.

@JaffaKetchup JaffaKetchup added invalid This bug could not be reproduced or does not exist, or is very low quality and removed needs triage This new bug report needs reproducing and prioritizing labels Sep 13, 2023
@JaffaKetchup JaffaKetchup closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
@d1ss0nanz
Copy link
Author

I've worked around this behaviour by implementing a custom TileProvider that removes the User-Agent header in getImage.

@ThomasAunvik
Copy link

@JaffaKetchup Why not just make the userAgentPackageName nullable? So then we can just set it to actually empty instead of 'unknown'.

String userAgentPackageName = 'unknown',

tileProvider = (tileProvider ?? NetworkTileProvider())
..headers.putIfAbsent(
'User-Agent', () => 'flutter_map ($userAgentPackageName)'),

It spams the console log.
image

@JaffaKetchup
Copy link
Member

I guess if this is really bothering people, it may be possible just to check kIsWeb. I'll make a PR at some point.

@JaffaKetchup JaffaKetchup changed the title [BUG] Flutter web: Refused to set unsafe header "User-Agent" [BUG] Web: Refused to set unsafe header "User-Agent" Oct 2, 2023
@JaffaKetchup JaffaKetchup added P: 3 (low) (Default priority for feature requests) and removed invalid This bug could not be reproduced or does not exist, or is very low quality labels Oct 2, 2023
@JaffaKetchup JaffaKetchup reopened this Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error P: 3 (low) (Default priority for feature requests)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants