43

Is there a way to modify an HTTP request using Chrome dev tools or Firebug? For example when developing locally and testing in Chrome, I have a page that needs an HTTP request to fill some data. Because it's local, that service isn't available.

Currently the only way of getting around the problem is configuring a proxy pass in Apache so it hits a QA environment for that call. I'm looking or a simpler way to achieve this because I use Jetty to test the app and can't configure a proxy pass (or that I know of).

In other words, is there a way to create a temporary proxy pass for the current session when testing an app locally?

J. Lin
  • 2,259
  • 5
  • 20
  • 17
  • 2
    You can try [Requestly](http://chrome.google.com/webstore/detail/requestly/mdnleldcmiljblolnjhpnblkcekpdkpa) for modifying HTTP requests in Chrome. It allows you to Rewrite urls, block websites, modify headers etc.. – Sachin Jain Apr 07 '16 at 13:46
  • Firefox as of 2018 can do it with its builtin Developer Tools (press F12 to activate it). – David Balažic Nov 15 '18 at 13:22
  • Does this answer your question? [Edit and replay XHR chrome/firefox etc?](https://stackoverflow.com/questions/28775123/edit-and-replay-xhr-chrome-firefox-etc) – T.Todua Jun 17 '20 at 23:21

3 Answers3

68

This might help in some cases - use fetch command to send another, tampered, request. here's how to do it in Chrome:

  1. open DevTools, tab Network
  2. clear
  3. create your request normally
  4. right click that request and select Copy > Copy as fetch
  5. go to Console tab and paste
  6. tamper the data and hit Enter

steps 1-4steps 5-6

oriadam
  • 7,747
  • 2
  • 50
  • 48
  • 4
    The request that I'm making results in a file download. When I do this (paste the fetch in the console), the request appears to be successful, but it doesn't trigger a file download in the browser. Is there a way to save the resulting file? – JoeMjr2 Mar 03 '22 at 21:34
14

You can use tweak chrome extension and you'll be able to do exactly that, intercept and modify HTTP requests.

Hvitis
  • 502
  • 5
  • 14
Daniel Caldas
  • 165
  • 1
  • 2
0

I am not sure if this solves your specific problem, but you can use Chrome Overrides to override file contents and response headers for web requests. This documentation https://developer.chrome.com/docs/devtools/overrides/ has been very handy for me when I want to modify a request in a remote environment.