Skip to content

Commit a99b40c

Browse files
authored
Update webview host address to 0.0.0.1 (#85)
This fixes iOS/MacCat 18 and also helps future-proof in case other platforms start blocking the old address (0.0.0.0). Fixes #78
1 parent e650bdb commit a99b40c

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

HybridWebView/Platforms/Android/HybridWebView.Android.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ namespace HybridWebView
66
{
77
partial class HybridWebView
88
{
9-
private static readonly string AppHostAddress = "0.0.0.0";
9+
private static readonly string AppHostAddress = "0.0.0.1";
1010

1111
/// <summary>
12-
/// Gets the application's base URI. Defaults to <c>https://0.0.0.0/</c>
12+
/// Gets the application's base URI. Defaults to <c>https://0.0.0.1/</c>
1313
/// </summary>
1414
private static readonly string AppOrigin = $"https://{AppHostAddress}/";
1515

HybridWebView/Platforms/MacCatalyst/HybridWebView.MacCatalyst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace HybridWebView
55
{
66
partial class HybridWebView
77
{
8-
internal const string AppHostAddress = "0.0.0.0";
8+
internal const string AppHostAddress = "0.0.0.1";
99

1010
internal const string AppOrigin = "app://" + AppHostAddress + "/";
1111
internal static readonly Uri AppOriginUri = new(AppOrigin);

HybridWebView/Platforms/Windows/HybridWebView.Windows.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ partial class HybridWebView
1010
// Using an IP address means that WebView2 doesn't wait for any DNS resolution,
1111
// making it substantially faster. Note that this isn't real HTTP traffic, since
1212
// we intercept all the requests within this origin.
13-
private static readonly string AppHostAddress = "0.0.0.0";
13+
private static readonly string AppHostAddress = "0.0.0.1";
1414

1515
/// <summary>
16-
/// Gets the application's base URI. Defaults to <c>https://0.0.0.0/</c>
16+
/// Gets the application's base URI. Defaults to <c>https://0.0.0.1/</c>
1717
/// </summary>
1818
private static readonly string AppOrigin = $"https://{AppHostAddress}/";
1919

HybridWebView/Platforms/iOS/HybridWebView.iOS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace HybridWebView
55
{
66
partial class HybridWebView
77
{
8-
internal const string AppHostAddress = "0.0.0.0";
8+
internal const string AppHostAddress = "0.0.0.1";
99

1010
internal const string AppOrigin = "app://" + AppHostAddress + "/";
1111
internal static readonly Uri AppOriginUri = new(AppOrigin);

MauiCSharpInteropWebView/Platforms/Windows/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
77
IgnorableNamespaces="uap rescap">
88

9-
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
9+
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.1" />
1010

1111
<mp:PhoneIdentity PhoneProductId="5B5DF893-8256-45F3-B7A6-10C1FFA69401" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
1212

MauiCSharpInteropWebView/Resources/Raw/hybrid_root/proxy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h1>HybridWebView demo: Proxy</h1>
6565
This is useful in scenarios where the request is being made from HTML elements, like an <code>img</code> tag, or a external library that only takes in string URLs.
6666
Proxy request URLs can be created with the format <code>/proxy?</code> and appending a custom query string. Some JavaScript libraries may require the full URL to be passed in.
6767
This can be done by calling <code>`${window.location.origin}/proxy?`</code> and appending the custom query string.
68-
Proxy URLs will look something like this: <code>https://0.0.0.0/proxy?myParameter=myValue</code> or <code>app://0.0.0.0/proxy?myParameter=myValue</code> depending on the platform.
68+
Proxy URLs will look something like this: <code>https://0.0.0.1/proxy?myParameter=myValue</code> or <code>app://0.0.0.1/proxy?myParameter=myValue</code> depending on the platform.
6969
</div>
7070
<div>
7171
<b>Create proxy URLs and pass into native HTML elements</b>

MauiReactJSHybridApp/Platforms/Windows/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
77
IgnorableNamespaces="uap rescap">
88

9-
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
9+
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.1" />
1010

1111
<mp:PhoneIdentity PhoneProductId="C144569D-A0AF-41CF-BBF9-CE7F1654CD23" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
1212

0 commit comments

Comments
 (0)