You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/Tutorials/Endpoints/Basics.md
+36
Original file line number
Diff line number
Diff line change
@@ -188,3 +188,39 @@ To set this property, include it in `server.psd1` configuration file as shown be
188
188
}
189
189
}
190
190
```
191
+
192
+
## Favicons
193
+
194
+
Pode allows you to customize or disable the favicon for HTTP/HTTPS endpoints. By default, Pode serves a built-in `favicon.ico`, but you can override this behavior using the `-Favicon` and `-NoFavicon` parameters.
195
+
196
+
-**`-Favicon` (byte[])**: Allows you to specify a custom favicon as a byte array.
197
+
-**`-NoFavicon` (switch)**: Disables the favicon, preventing browsers from requesting it.
198
+
199
+
### **Favicon Format and Specifications**
200
+
201
+
Favicons are typically stored in the `.ico` format, which is a container that can hold multiple image sizes and color depths. This ensures compatibility with different browsers and devices. Some modern browsers also support `.png` and `.svg` favicons.
202
+
203
+
For more details on favicon formats and specifications, refer to the [Favicon specification](https://en.wikipedia.org/wiki/Favicon) and [RFC 5988](https://datatracker.ietf.org/doc/html/rfc5988).
204
+
205
+
### **Favicon Size Recommendations**
206
+
207
+
Favicons should include multiple resolutions for optimal display across different devices. Recommended sizes include:
208
+
209
+
-**16x16** → Used in browser tabs, bookmarks, and address bars.
210
+
-**32x32** → Used in browser tabs on higher-resolution displays.
211
+
-**48x48** → Used by some older browsers and web applications.
212
+
-**64x64+** → Generally not used by browsers but can be helpful for scalability in web apps.
213
+
-**256x256** → Mainly for **Windows app icons** (not typically used as a favicon in browsers).
Copy file name to clipboardexpand all lines: src/Private/PodeServer.ps1
+47-40
Original file line number
Diff line number
Diff line change
@@ -210,59 +210,66 @@ function Start-PodeWebServer {
210
210
if ($Request.IsAborted) {
211
211
throw$Request.Error
212
212
}
213
-
214
-
# if we have an sse clientId, verify it and then set details in WebEvent
215
-
if ($WebEvent.Request.HasSseClientId) {
216
-
if (!(Test-PodeSseClientIdValid)) {
217
-
throw [Pode.PodeRequestException]::new("The X-PODE-SSE-CLIENT-ID value is not valid: $($WebEvent.Request.SseClientId)")
218
-
}
219
-
220
-
if (![string]::IsNullOrEmpty($WebEvent.Request.SseClientName) -and!(Test-PodeSseClientId-Name $WebEvent.Request.SseClientName-ClientId $WebEvent.Request.SseClientId)) {
221
-
throw [Pode.PodeRequestException]::new("The SSE Connection being referenced via the X-PODE-SSE-NAME and X-PODE-SSE-CLIENT-ID headers does not exist: [$($WebEvent.Request.SseClientName)] $($WebEvent.Request.SseClientId)",404)
222
-
}
223
-
224
-
$WebEvent.Sse=@{
225
-
Name=$WebEvent.Request.SseClientName
226
-
Group=$WebEvent.Request.SseClientGroup
227
-
ClientId=$WebEvent.Request.SseClientId
228
-
LastEventId=$null
229
-
IsLocal=$false
230
-
}
213
+
214
+
# deal with favicon if available
215
+
if ($WebEvent.Path-eq'/favicon.ico'-and ($null-ne$PodeContext.Server.Endpoints[$context.EndpointName].Favicon)) {
# if we have an sse clientId, verify it and then set details in WebEvent
221
+
if ($WebEvent.Request.HasSseClientId) {
222
+
if (!(Test-PodeSseClientIdValid)) {
223
+
throw [Pode.PodeRequestException]::new("The X-PODE-SSE-CLIENT-ID value is not valid: $($WebEvent.Request.SseClientId)")
224
+
}
225
+
226
+
if (![string]::IsNullOrEmpty($WebEvent.Request.SseClientName) -and!(Test-PodeSseClientId-Name $WebEvent.Request.SseClientName-ClientId $WebEvent.Request.SseClientId)) {
227
+
throw [Pode.PodeRequestException]::new("The SSE Connection being referenced via the X-PODE-SSE-NAME and X-PODE-SSE-CLIENT-ID headers does not exist: [$($WebEvent.Request.SseClientName)] $($WebEvent.Request.SseClientId)",404)
228
+
}
232
229
233
-
# invoke global and route middleware
234
-
if ((Invoke-PodeMiddleware-Middleware $PodeContext.Server.Middleware-Route $WebEvent.Path)) {
235
-
# has the request been aborted
236
-
if ($Request.IsAborted) {
237
-
throw$Request.Error
230
+
$WebEvent.Sse=@{
231
+
Name=$WebEvent.Request.SseClientName
232
+
Group=$WebEvent.Request.SseClientGroup
233
+
ClientId=$WebEvent.Request.SseClientId
234
+
LastEventId=$null
235
+
IsLocal=$false
236
+
}
238
237
}
239
238
240
-
if ((Invoke-PodeMiddleware-Middleware $WebEvent.Route.Middleware)) {
239
+
# invoke global and route middleware
240
+
if ((Invoke-PodeMiddleware-Middleware $PodeContext.Server.Middleware-Route $WebEvent.Path)) {
0 commit comments