Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random "/favicon.ico 404 NOT FOUND" error only when login in #31025

Open
3 tasks done
arm-moodys opened this issue Nov 21, 2024 · 1 comment
Open
3 tasks done

Random "/favicon.ico 404 NOT FOUND" error only when login in #31025

arm-moodys opened this issue Nov 21, 2024 · 1 comment
Labels
deploy:helm infra:webserver Infra setup and configuration related to webserver

Comments

@arm-moodys
Copy link

arm-moodys commented Nov 21, 2024

Bug description

Hi

We're running into an issue that happens more often that not,

I have deployed Superset on multiple environments on K8s using the official HelmChart, it's running on AWS EKS behind a Network Load Balancer, for ingress we use the Ngnix Ingress controller Helm chart.

The Log in page loads correctly every time we access it, no problems there.

The issue is after we provide the credentials and click on the SIGN IN button, most times it hangs and return a 404 NOT FOUND for the https://<DOMAIN_NAME>/favicon.ico
image

on the superset pod logs I can see the following every time it fails:

HTTPException
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1788, in dispatch_request
    self.raise_routing_exception(req)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1770, in raise_routing_exception
    raise request.routing_exception  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/flask/ctx.py", line 351, in match_request
    result = self.url_adapter.match(return_rule=True)  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/werkzeug/routing/map.py", line 624, in match
    raise NotFound() from None
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
2024-10-03 23:06:28,240:WARNING:superset.views.base:HTTPException
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1788, in dispatch_request
    self.raise_routing_exception(req)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1770, in raise_routing_exception
    raise request.routing_exception  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/flask/ctx.py", line 351, in match_request
    result = self.url_adapter.match(return_rule=True)  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/werkzeug/routing/map.py", line 624, in match
    raise NotFound() from None
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
10.173.88.147 - - [03/Oct/2024:23:06:28 +0000] "GET /favicon.ico HTTP/1.1" 404 0 "http://DOMAIN_OBFUSCATED/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

As far as I understand all modern browser send a request to https://<DOMAIN_NAME>/favicon.ico, the problem is that the Superset favicon.icois actually under/static/assets/images/favicon.pngso if you go tohttps://<DOMAIN_NAME>//static/assets/images/favicon.png` you will see it, I know that the icon can be modified by adding the following to the superset_config.py and actually having the file in the specified path inside the container:

FAVICONS = [
      {"href": "/static/assets/images/favicon.png"},
      {
        "href": "/favicon.ico",  ## This is not accessible although the file exists this is I belive because flask doesn't expose anything but the what is under `/static` which in the container is under `/app/superset/static`
        "rel": "icon",
        "type": "image/x-icon",
      },
      {
        "href": "/static/favicon.ico", ## This accessible through: `https://<DOMAIN_NAME>//static/favicon.png`
        "rel": "icon",
        "type": "image/x-icon",
      }
    ]

I have already tried all the suggested "workarounds" mentioned on:

The last 2 links above mention a way to a flask route to expose the favicon.ico but so far I always ended up with a RuntimeError: Working outside of application context. error.

Semi "Workaround"

Before continuing I want to clarify that the issue happens even without the AWS NLB, we tested this by simply forwarding the port locally and the same errors happens:

kubectl port-forward service/superset 8088:8088

My "workaround" so far is the following:

In the superset_config.py I increase the SUPERSET_WEBSERVER_TIMEOUT env variable value

SUPERSET_WEBSERVER_TIMEOUT = 180

In my K8s ingress I add the following annotations:

annotations: # https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#custom-timeouts
    nginx.ingress.kubernetes.io/proxy-read-timeout: "200"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "200"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "200"

With that the hang issue persists but after approximately 2:30 mins the log in is successful or rejected if the users provides the wrong credentials but it takes a very long time to come back with the proper return.

Besides all the suggestions mentioned above and in the links shared, do you have any other suggestions of what I can try?

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented Nov 21, 2024

Hey there, @arm-moodys! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together!

I found a similar unsolved discussion that might be relevant to your issue: Custom Logo with Docker + nginx-proxy not working [1].

To address the "404 NOT FOUND" error for "/favicon.ico" in Superset, ensure that the favicon path is correctly configured. According to the superset/config.py, the favicon is set as follows:

FAVICONS = [{"href": "/static/assets/images/favicon.png"}]

Make sure the file /static/assets/images/favicon.png exists in your Superset deployment. If the file is missing, place the favicon image at the specified path. If the path is incorrect, update the FAVICONS configuration with the correct path to your favicon file.

If the file exists and the path is correct, but you are still encountering the error, check your Nginx Ingress configuration to ensure that requests to /favicon.ico are correctly routed to the Superset application. You may need to add a location block in your Nginx configuration to handle requests for the favicon [2].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added deploy:helm infra:webserver Infra setup and configuration related to webserver labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy:helm infra:webserver Infra setup and configuration related to webserver
Projects
None yet
Development

No branches or pull requests

1 participant