hotwired / hotwire-native-ios

Hotwire Native for iOS
MIT License
70 stars 7 forks source link

Custom domains are not working except localhost, hotwire-native-demo.dev, github #45

Closed developerJai closed 1 day ago

developerJai commented 1 day ago

I am trying to fetch the webpage using custom domains. A loader appears after the splash screen for a couple of seconds, after which I receive an error.

The page could not be loaded due to a configuration error.

Although IPs are working and some of URLs are working fine:

Here is the code:

import HotwireNative
import UIKit

//let rootURL = URL(string: "http://rishabhdubey.com")!
let rootURL = URL(string: "https://1dde-2405-201-4019-6a1e-b442-4335-e07-67b9.ngrok-free.app")!
//let rootURL = URL(string: "http://192.168.29.201:3000/")!

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    var window: UIWindow?

    private let navigator = Navigator()

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        window?.rootViewController = navigator.rootViewController
        navigator.route(rootURL)
    }
}

Description

leonvogt commented 1 day ago

I've made the experience that free ngrok domains aren't working, because of the "landing page" you'll see when visiting the domain for the first time:

CleanShot 2024-11-12 at 08 37 00

They're saying we could set a ngrok-skip-browser-warning header, but I couldn't get it to work.
The easiest solution is to subscribe to the $8/month ngrok personal plan, which removes the landing page entirely.
This way, I can test https-related features like camera access locally without issues. Note: There is a free local https tool that looks promising, though I haven't tested it yet: Ophiuchi.

developerJai commented 1 day ago

Thank you for your reply, @leonvogt. However, the issue is not limited to ngrok; it also affects other custom domains.

If you try accessing https://google.com or https://www.amazon.com, you will see that they are not working.

The problem lies with the custom domains, while the IPs are functioning properly.

leonvogt commented 1 day ago

Hm don't quote me on that, but I think it may only work on sites that have Turbo installed.

joemasilotti commented 1 day ago

@leonvogt is correct, the website needs Turbo.js for Hotwire Native to work.