Clientraw files on a different web page

trying to set up vær.net with freshwdl. I wants to take the clientraw files from my another site, but cant get it to work.
can anyone see any errors in my config.js file?

/*jslint plusplus: true, sloppy: true, indent: 4 */

//Ajust these values to your liking.
var clientRawName = “/clientraw.txt”, //The names of your clientraw files
clientRawExtraName = “/clientrawextra.txt”,
clientRawHourName = “/clientrawhour.txt”,
clientRawDailyName = “/clientrawdaily.txt”,
lang = “nb”, //Set Language. To see what lanuages are currently supported, see the readme file at: FreshWDL/README.md at master · Yerren/FreshWDL · GitHub
customBaseURL = “https://www.nodeland.no/wdl2/”, // OPTIONAL: Set the path to where your clientraw files are uploaded e.g., “goldenbaynzweather.info” (note: final backslash and quotation marks must be included). Otherwise leave as: false
currentUnits = { //Default units (what the page will display when first loaded)
pressure: “mb”, //Options: “hPa” “mmHG” “kPa” “inHg” “mb”
altitude: “m”, //Options: “m” “yds” “ft”
wind: “ms”, //Options: “kmh” “mph” “kts” “ms” “mm” “inch”
rainfall: “mm”, //Options: “mm” “inch”
windDirection: “deg”, //Options: “deg” (only one)
humidity: “percent”, //Options: “percent” (only one)
solar: “Wm”, //Options: “Wm” (only one)
uv: “noUnit”, //Options: no units for UV
temp: “celsius” //Options: “celsius” “fahrenheit”
},
gaugeSettings = { //Gauges: apparent temperature barometer windChill graphHandlerBarometer graphHandlerRainfall graphHandlerTemperature graphHandlerWindSpeed humidity moonSun solar status rainfallTitle rainfallDay rainfallMonth rainfallYear UV windDirection windSpeed
solar: {
enabled: true
},
UV: {
enabled: true
}
};

when you say another site, do you mean a different web server? (i.e not local to where FreshWDL is ) or do you mean a different directory on the same server
(its not very clear)

looking at what info posted there is a line missing the customBaseURL

var clientRawName = “clientraw.txt”, //The names of your clientraw files
clientRawExtraName = “clientrawextra.txt”,
clientRawHourName = “clientrawhour.txt”,
clientRawDailyName = “clientrawdaily.txt”,
customBaseURL = false, // OPTIONAL: Set the path to where your clientraw files are uploaded e.g., “goldenbaynzweather.info” (note: final backslash and quotation marks must be included). Otherwise leave as: false
lang = “en”, //Set Language. To see what lanuages are currently supported, see the readme file at: FreshWDL/README.md at master · Yerren/FreshWDL · GitHub

that is the line needed to read clientraw files on a different server

Brian,
The clientraw file ar in another different web server

I wants to use is on a second wdbserver www vær.no, and the clientraw files are on www.nodeland.no/wdl2
i tryed in the config.js file oi write: customBaseURL = “https://www.nodeland.no/wdl2/”, // OPTIONAL: but that don’t work.

I tried a copy on my local server trying to get the clientraw files from my main site but it failed also tried yours and that failed so not sure why it not working

You could set WD to upload a second clientraw to the second webserver.


It might be a cross domain block by the browser that’s stopping it. Browsers block certain data access attempts from a site on one server trying to access data from another server. That kind of activity (called Cross Origin Resource Sharing – CORS) can be used by hackers for evil purposes so the browser blocks it
by default unless certain settings are made in the web server software to allow it.

I can’t confirm this without testing but if this is the problem then it might prove easier to upload a copy of the files to your second server. I’ll see if I can test this tomorrow.

I know that the customBaseUrl setting works when it’s on the same domain because that’s how I have FreshWDL set up. My clientraw file isn’t in the same directory as my FreshWDL installation.

I’ve had a chance to test this now and it is CORS that stops this working. There may be an easy fix (if your web server supports it).

You need to add a file called ‘.htaccess’ (note the leading ‘.’) in the same directory that contains your clientraw.txt file, i.e. on the first/original server. In the .htacess file put the following…


######################
## Handling Options for CORS
     RewriteCond %{REQUEST_METHOD} OPTIONS
     RewriteRule ^(.*)$ $1 [L,R=204]

##################
## Add custom headers

    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
       # Always set these headers for CORS.
    Header always set Access-Control-Max-Age 1728000
    Header always set Access-Control-Allow-Origin: "http://host.seconddomain.tld"
    Header always set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
    Header always set Access-Control-Allow-Headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control"
    Header always set Access-Control-Allow-Credentials true

Replace “http://host.seconddomain.tld” with the host+domain name of your second server, i.e. the server that you to use the second copy of FreshWDL on. I’ve done this on a test server and it works for me so give it a go!