A few days ago my Google Apps Script based webhooks stopped receiving data. Did Particle stop following redirects?
Before the change I’d get a response like this, the important part is the last line which includes a json response:
HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Fri, 04 Jun 2021 23:00:46 GMT
Location: https://script.googleusercontent.com/macros/echo?user_content_key=[Redacted]
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked
wcE1rNnK7-A5tUgR-2A5Y8pQhhfohb8_3uAuuQeeNUgoZnGb9qzIgvKfVnhjI6Uu&lib=MkaAdOO_XMZ1PS0_dlp1L7-bgvsarGwYw">here</A>.
</BODY>
</HTML>
0
{"error_code":0,"result":{"responseData":"{\"system\":{\"set_relay_state\":{\"err_code\":0}}}"}}
Oddly the response body has part of the redirect html but not the full thing, I left it as-is, that’s exactly how it was listed in the Particle Integrations response. Here’s what has been happening since then, full redirect response html but no json that would result from following the redirect:
HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Sat, 05 Jun 2021 00:53:50 GMT
Location: https://script.googleusercontent.com/macros/echo?user_content_key=[Redacted]
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked
<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="https://script.googleusercontent.com/macros/echo?user_content_key=[Partially Redacted]wcE1rNnK7-A5tUgR-2A5Y8pQhhfohb8_3uAuuQeeNUgoZnGb9qzIgvKfVnhjI6Uu&lib=MkaAdOO_XMZ1PS0_dlp1L7-bgvsarGwYw">here</A>.
</BODY>
</HTML>
So no Json result anymore and I’m not sure how to get it back. Google’s redirect is a security feature that has existed for years. Any ideas?