Hi <@UM5G69R8W> I can see you asked the same quest...
# kvision
k
Hi @Lars Erik Rojeras I can see you asked the same question before. I am also having an issue on displaying favicon.ico from index.html. I tried with a new png image (favicon.png) as per the w3 recommendation, but still it is a 404 when called from index.html. How did you manage to show the favicon? Do we need to host externally and give an absolute url?
r
l
Now it works with a link tag in the head section
<link rel="icon" href="tpnet.png" type="image/png">
k
Thanks, both. Somehow it doesn't show when run as jar.. It works when I run frontend separately. It must be something with the setup.. I have my image under src/frontendMain/web/img/favicon.png. and have this tag.
<link rel="icon" href="img/favicon.png" type="image/png">
r
can you download the image directly with /img/favicon.png url?
k
Nope, it gives 404 on

http://localhost:8080/img/favicon.png

r
it looks similar to your previous problem, when something intercepted requests to the backend server
could you check the content of your fatjar? in
BOOT-INF/lib
you should have a
<project>-frontend-<version>.jar
file
and inside this jar you should have all the resources in `/public' (including
public/img/favicon.png
)
if its there, then something indeed probably intercepts your requests - perhaps you have some custom configuration (like authentication), maybe some filters? or there is some custom configurations in your libraries
k
To answer your first question; Yes the localhost:8080/index.html works (without the favicon). Then inside the frontend jar the public folder has my favicon but saved as. 3a29438d1ce163ced44546183b57743c.png
r
And you have
src/frontendMain/web/img/
folder in your project but no
img
inside frontend jar
/public/
?
what about
build/distributions
- is
img
there?
are you sure you have your favicon inside
src/frontendMain/web/img
and not
src/frontendMain/resources/img
?
k
ah maybe that is the issue.. I have my img folder under /src/frontendMain/resources . As all other images are under that folder and works. I will move it to web/img and try
Yes, that worked.. Thank you
r
Just to explain: the things in the
resources
folder should be used with the
require()
function and are processed by webpack (images are mangled, css inlined, etc.), the
web
folder on the other hand is just copied to the destination bundle (zip file, fatjar etc) and all elements can be used directly from the browser (and from the
index.html
file).
👍 1