swisspol / GCDWebServer

The #1 HTTP server for iOS, macOS & tvOS (also includes web based uploader & WebDAV server)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Out of date content is being served after app version upgrade

iamthefox opened this issue · comments

Hi,

I am using GCDWebServer in a react-native app to server a static html folder from a bundle.

I am starting a server using:

let websiteroot = Bundle.main.path(forResource: "www", ofType: nil)!;
    webServer.addGETHandler(forBasePath: "/", directoryPath: websiteroot, indexFilename: "index.html", cacheAge: 0, allowRangeRequests: false)

try webServer.start(options: [
            GCDWebServerOption_Port: 8080,
            GCDWebServerOption_BindToLocalhost: true,
            GCDWebServerOption_AutomaticallySuspendInBackground: true])

It works fine and serves html correctly up to the point where I update the app (via appstore or manually).

After update it keeps serving static html content from a previous build instead of a new one.

Is this expected behaviour? If so is it possible to kill a server and serve new content?

Currently the only way around it is to uninstall app and install a fresh one in order to receive latest html.