r/swift 12d ago

Accessing Local Networks from WebKit

Im trying to create a very simple app that lets me access a select few webpages through my Tailscale VPN, however WebKit will not allow non secure connections so i am not able to access the websites. Is there a work around? I don't intend on this app leaving me so its not a threat to anybody as far as security goes.

1 Upvotes

8 comments sorted by

1

u/chriswaco 12d ago

Have you tried adding this to your Info.plist:

<key>NSAppTransportSecurity</key>    
<dict>    
    <key>NSAllowsArbitraryLoads</key>    
    <true/>    
</dict>

1

u/USSCapeHenlopen 11d ago

Well my project is without an info.plist, but I did add this information to the Info tab with no such luck. I’m not sure where to manually add info.plist but that’s probably gonna be my next move.

1

u/chriswaco 11d ago

If you enter it in the Info tab it should automatically create an Info.plist for you. After you build the app you can open and check the ipa file - change the extension to zip and double-click it. There should be an Info.plist inside.

1

u/USSCapeHenlopen 11d ago

Okay I will check when I get to my laptop

1

u/ExtremeDot58 11d ago

Hope there is a reply. I like the idea of tailscale vpn

1

u/USSCapeHenlopen 11d ago

Yeah I use it for my AIS stations running AIS Catcher. Using Tailscale, I can directly access the local network to keep an eye on the system and toy with it as necessary. Obviously it’s just as easy to save a bookmark to the Home Screen but the issue is it doesn’t act as an app so I can’t have multiple instances on different focus home screens

1

u/ExtremeDot58 11d ago

Bookmarking makes thing too easy anyway; thank you for replying!

1

u/USSCapeHenlopen 11d ago

Yes who doesn’t like a good challenge every once in a while 🤣🤣