Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to modify an HTTP request in Chrome or Firefox?

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?

like image 422
J. Lin Avatar asked Apr 08 '14 08:04

J. Lin


People also ask

How do I get the HTTP request body in Chrome?

To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.

How do I use cURL command in Chrome?

From Chrome On the line of the specific resource you're interested in, you right-click with the mouse and you select “Copy as cURL” and it'll generate a command line for you in your clipboard. Paste that in a shell to get a curl command line that makes the transfer.

How do I replay a Chrome request?

Just right click on the request and select Replay XHR.


3 Answers

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

like image 117
oriadam Avatar answered Oct 10 '22 17:10

oriadam


There are many tools/ extensions in Chrome and Firefox which allow you to modify network requests.

One such example is Requestly. Using Requestly you can do the following tasks:

  1. Redirect network requests.
  2. Block websites or specific requests.
  3. Switch domains using Replace Rule.
  4. Modify Headers
  5. Modify UserAgent Documentation1 Documentation 2
  6. File Library (Host JS, CSS, JSON) and use them in Requestly rules

There are more features but for your specific use case. You can host your js or css on library and redirect to it using Redirect Rule. If you have URL rewriting requirement, then you can use either Redirect or Replace rule.

I won't say Requestly is as powerful as Fiddler or Charles but I'd say that it is pretty close with much simplistic UI.

Disclaimer: I built Requestly!

like image 29
Sachin Avatar answered Oct 10 '22 18:10

Sachin


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

like image 41
Daniel Caldas Avatar answered Oct 10 '22 16:10

Daniel Caldas