0

I have an esp32-cam video stream which pushes to a local IP address From the tech docs this format is mjpeg. The camera code is generated by platformio in vs code using espidf I can view this video on both chrome and Firefox locally. I wanted to stream this to an existing https domain which uses nginx. I added a websocket proxy pass from https://<my_domain>:443 to the local IP address I can view this video on my website with Firefox , no problem. However on Chrome and Edge i get the error "431 (Request Header Fields Too Large)" Printed below is the raw request headers from Chrome developer I have tried all the fixes i can find on the web. i.e. Clear cookies. The Referrer URL seems short to me Would anyone be able to throw light on this problem.

typeGET / HTTP/1.1
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Host: <my_domain>:443
Pragma: no-cache
Referer: https://<my_domain>/
Sec-Fetch-Dest: image
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux" here

I have tried changing the https port. I have used both jquery and pure javascript to render the video on my web page I have tried embedding the video src directly in HTML I have checked on wire shark to see if i can spot any anomalies

all with the same result. I am a beginner programmer and am stymied at this stage

My nginx redirect code is:

# redirect WebSockets
    location / {
        proxy_pass http://192.168.1.69:80/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host ,my_domain>;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
ianc
  • 1
  • 1
  • Does [this](https://stackoverflow.com/questions/59625785/431-request-header-fields-too-large) help? – FiddlingAway Aug 28 '23 at 13:12
  • Thanks for that. No i had done all that with no joy. – ianc Aug 28 '23 at 21:18
  • I seem to have solved the problem in a strange way. One of the problems with the esp32-cam is that it can only be used by one viewer at a time. In my attempts to solve this problem I stumbled across this github site. https://github.com/arkhipenko/esp32-cam-mjpeg-multiclient. I implemented this solution and used this link on my webpage. The header is actually longer but it now works on Firefox and Chrome. I would still like to find out why the single user responded with the error as i was the only user at all times. – ianc Aug 28 '23 at 21:32

0 Answers0