I have a strange behavior when testing the Wt::WApplication
. It seems that a single browser window will trigger up to 3 sessions. Only the first session will remain, as the other 2 will expire shortly after.
Does anybody experience a similar problem?
Wt version: 4.5.0 Windows Build
Main:
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
return std::make_unique<Wt::WApplication>(env);
});
}
The application is invoked with:
--approot ../../../approot --docroot "../../../docroot;/styles.css,/images,/sitemaps,/robots.txt" --http-address localhost --http-port 8080
Wt Log:
[2022-May-30 21:59:45.798] 12704 - [info] "config: reading Wt config file: ../../../approot/wt_config.xml (location = 'exe')"
[2022-May-30 21:59:45.811] 12704 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://127.0.0.1:8080 (localhost)"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://[::1]:8080 (localhost)"
[2022-May-30 21:59:53.050] 12704 - [info] "Wt: session created (#sessions = 1)"
[2022-May-30 21:59:53.055] 12704 [/ FLh8WMlSxcWspyVs] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
127.0.0.1 - - [2022-May-30 21:59:53.073] "GET / HTTP/1.1" 200 4094
[2022-May-30 21:59:53.073] 12704 - [info] "WebRequest: took 23.66 ms"
[2022-May-30 21:59:53.118] 12704 - [info] "Wt: session created (#sessions = 2)"
[2022-May-30 21:59:53.120] 12704 - [info] "Wt: session created (#sessions = 3)"
[2022-May-30 21:59:53.124] 12704 [/ MmvFYbPrMWDpcoxB] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-May-30 21:59:53.126] 12704 [/ J8CGX3nPrlUWZEOU] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
Chrome Dev-Tool network output:
The last one is repeated afterwards.
I would be really happy to get some advice :) Best regards
I assume the two extra session are created for the http://127.0.0.1:8080/resources/...
requests. Adding /resources
to the docroot
list of static file paths should prevent such requests from starting a new session.
It may also be useful to add --resources-dir /path/to/wt/install/share/Wt/resources
, to allow Wt to find those resources provided by Wt itself.