Search code examples
reactjsspringrestjmeterhttp-status-code-405

ReactJS - Method not allowed in JMeter but in web browser works


I'm getting error 405 while trying to upload files from client side in JMeter. I've also tried recording scripts but that doesn't seem to work because it doesn't capture needed action. Everything works fine when done in the web browser and I don't get then any errors, but when it comes to testing in JMeter the error appears. enter image description here

I have an application written in ReactJS and SpringBoot.


Solution

  • As per your server response you're allowed to only send GET and HEAD methods while file upload is possible with POST and PUT so most probably you either need to ensure that your URL is correct or it might be the case you need to be authenticated prior to uploading the file and this authentication logic fails somewhere somehow.

    If you properly configure JMeter and the web browser for recording, to wit:

    1. Start JMeter's HTTP(S) Test Script Recorder
    2. Install JMeter's certificate into your browser
    3. Copy the file(s) you are going to upload to "bin" folder of your JMeter installation
    4. Configure your browser to use JMeter as the proxy

    you should be able to record your browser's HTTP and HTTPS traffic and JMeter should generate relevant HTTP Request sampler(s) and HTTP Header Manager(s) so you should be able to replay your script (some correlation may be still required)