I have a Swift project with a webview that is serving files from a local folder vai GCDwebserver, however the website is designed as a single page application, is there any way I can rewrite all url requests to index.html?
I'm currently using GCDwebserver but I'm willing to change servers to get the SPA to load in the webview.
With nginx I'd do somthing like
server {
listen 8080;
listen [::] 8080;
root /root/bundled;
location / {
try_files $uri $uri/ /index.html;
}
}
How do I get the same rewrite effect on a webview in osx?
Simply use a default handler to catch all GET request:
Or a regex one if you want to do more fancy matching:
Or even go all the way to a match block: