scrapinghub / splash

Lightweight, scriptable browser as a service with an HTTP API
BSD 3-Clause "New" or "Revised" License
4.1k stars 513 forks source link

Cannot send custom HTTP headers to 'execute' endpoint #1011

Open mwbelt opened 4 years ago

mwbelt commented 4 years ago

I can't seem to find a way to send custom http headers to the 'execute' or 'run' endpoint. I've seen several examples of how to properly send them to the 'render.html' endpoint (https://github.com/scrapinghub/splash/issues/628 and https://github.com/scrapinghub/splash/issues/775) but none of those options work for execute. Can anybody give me a solid example?

mwbelt commented 4 years ago

Anybody else experiencing this? It's crazy frustrating.

lucywang000 commented 4 years ago

The execute api is the most powerful one, you can set custom headers with lua scripts.

        splash:on_request(function (request)
                request:set_header("X-Some-Header", "Some-Value")
        end)