[GH-ISSUE #1956] Failed to set header User-Agent #630

Closed
opened 2026-03-16 16:26:22 +03:00 by kerem · 1 comment
Owner

Originally created by @WqyJh on GitHub (Nov 16, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1956

Describe the bug
I've specified an User-Agent header in my request, but the server got User-Agent of Chrome browser.

To Reproduce
Steps to reproduce the behavior:

  1. Run an simple http server: save the following content as 3serv.py, run with python3 3serv.py, you'll get an http server listening on port 8000 which print header when received requests.
    #!/usr/bin/env python3
    
    import http.server as SimpleHTTPServer
    import socketserver as SocketServer
    import logging
    
    PORT = 8000
    
    class GetHandler(
            SimpleHTTPServer.SimpleHTTPRequestHandler
            ):
    
        def do_GET(self):
            logging.error(self.headers)
            SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
    
    
    Handler = GetHandler
    httpd = SocketServer.TCPServer(("", PORT), Handler)
    
    httpd.serve_forever()
    
  2. Make an request with hoppscotch

image

  1. See the output of http server: shows the user agent of chrome browser, indicating failure of setting user-agent header.

image

Expected behavior
Custom User-Agent show on http server.

Originally created by @WqyJh on GitHub (Nov 16, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1956 **Describe the bug** I've specified an User-Agent header in my request, but the server got User-Agent of Chrome browser. **To Reproduce** Steps to reproduce the behavior: 1. Run an simple http server: save the following content as `3serv.py`, run with `python3 3serv.py`, you'll get an http server listening on port 8000 which print header when received requests. ```python #!/usr/bin/env python3 import http.server as SimpleHTTPServer import socketserver as SocketServer import logging PORT = 8000 class GetHandler( SimpleHTTPServer.SimpleHTTPRequestHandler ): def do_GET(self): logging.error(self.headers) SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) Handler = GetHandler httpd = SocketServer.TCPServer(("", PORT), Handler) httpd.serve_forever() ``` 2. Make an request with hoppscotch ![image](https://user-images.githubusercontent.com/15232241/142003381-14045647-016b-4700-94c2-731763bff36e.png) 3. See the output of http server: shows the user agent of chrome browser, indicating failure of setting user-agent header. ![image](https://user-images.githubusercontent.com/15232241/142003511-3bcd7bc4-1270-46fe-90f6-5a82ed3c2045.png) **Expected behavior** Custom User-Agent show on http server.
kerem closed this issue 2026-03-16 16:26:37 +03:00
Author
Owner

@liyasthomas commented on GitHub (Nov 16, 2021):

User-Agent is one among the other Forbidden header names. Though Firefox 43 and above supports setting the User-Agent header from the client-side, and Chrome will silently drop the header from fetch requests.

Since this is a browser-defined security policy and is not directly connected with Hoppscotch - I'm choosing this issue. I was able to set custom user-agent in Hoppscotch from the Firefox browser. Simply install our Firefox extension interceptor and run the request with a custom User-Agent header and it should work.

Screenshot

Screenshot 2021-11-16 at 10 48 31 PM
<!-- gh-comment-id:970490643 --> @liyasthomas commented on GitHub (Nov 16, 2021): `User-Agent` is one among the other [Forbidden header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name). Though Firefox 43 and above supports setting the `User-Agent` header from the client-side, and Chrome will silently drop the header from fetch requests. Since this is a browser-defined security policy and is not directly connected with Hoppscotch - I'm choosing this issue. I was able to set custom user-agent in Hoppscotch from the Firefox browser. Simply install our [Firefox extension interceptor](https://addons.mozilla.org/en-US/firefox/addon/hoppscotch) and run the request with a custom `User-Agent` header and it should work. Screenshot <img width="1440" alt="Screenshot 2021-11-16 at 10 48 31 PM" src="https://user-images.githubusercontent.com/10395817/142033765-59ffdc8e-e583-4740-b2fc-e1af3f7a2da2.png">
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#630
No description provided.