question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cloud function return 404 for /favicon.ico

See original GitHub issue

I use cloud function as a reverse proxy between client(browser) and GCS bucket.

Fetch the GCS bucket object and create readable stream to pipe to client.

When I request /favicon.ico it returns 404.

There’s an existing logic to return 404 for /favicon.ico|/robots.txt.

Ref: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/07668f696b29f077d4ba9d0463ea994076cdab50/src/server.ts#L122+L125

I haven’t thought about the solution which also fulfill the original purpose, just to provide my use case.

Ref: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/pull/193

Thank you.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
eastlondonercommented, Jun 18, 2022

Hi @grant I am running into this problem.

Would it be possible to have some configuration option to disable this very specific behaviour where Google Cloud http triggered functions object to serving /favicon.ico

The Google Cloud Firebase documentation has examples of using a Google Cloud Function to host an express web app which literally relies on the URL path - which is at odds with your statement:

the URL path should not be part of the logic of the function

https://firebase.google.com/docs/hosting/functions#use_a_web_framework

0reactions
grantcommented, Apr 26, 2022

To follow up here, Cloud Functions is meant to serve and invoke a single function when receiving a HTTP request. The URL path should not be part of the logic of the function. For example, Cloud Functions Gen 1 and Gen 2 have different URL paths.

For this use-case of using URL paths within the function, I would consider using express directly with Cloud Run and not using the Functions Framework.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requesting /favicon.ico URL invokes function, ignores its ...
Unexpected behavior invoker.ts handles the URLs '/favicon.ico' and '/robots.txt' specially, by sending back a 404 response.
Read more >
How can I return a 204 rather than 404 for a missing favicon ...
When a favicon.ico file is not found, Nginx returns my define 404 error page, as well as the 404 HTTP status code. However,...
Read more >
Guide to the Favicon in Spring Boot | Baeldung
Learn how to customize the favicon in a Spring Boot application. ... A favicon is a small website icon displayed in a browser,...
Read more >
has_ipv4() - Azure Data Explorer | Microsoft Learn
In this article. Syntax; Arguments; Returns; Examples. Returns a value indicating whether a specified IPv4 address appears in a text.
Read more >
How to Fix Error 404 Not Found on Your WordPress Site - Kinsta
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found