Dokku / NGINX not passing headers

Sometimes you just have to do a workaround when systems aren’t doing what they are supposed to, I have been building this API proxy for Weather Driver. Dokku / NGINX wasn’t passing the proper headers to my server, so I had to do a workaround.

The work around I came up with was to pass all the values in as part of the Request body. I still would like to figure out what the initial problem was caused by. If I come up with a full solution I will post back here about it.

Converting a callback function to async await in Swift

Occasionally you will need to convert a callback based function to an async/await function. One example of this is below, calculating a map route appears to be only available as a callback based one. Below is an example of how to convert it to an async function. This code is actually used in Weather Driver.

func calculateSubRoute(route: MKRoute, step: MKRoute.Step) async throws -> MKDirections.Response? {
	return try await withCheckedThrowingContinuation { continuation in
		let request = MKDirections.Request()
		request.source = MKMapItem(placemark: MKPlacemark(coordinate: route.steps.first!.polyline.coordinate))
		request.destination = MKMapItem(placemark: MKPlacemark(coordinate: step.polyline.coordinate))
		request.requestsAlternateRoutes = true
		request.transportType = .automobile

		let directions = MKDirections(request: request)
		directions.calculate() { response, error in
			if error != nil {
				continuation.resume(throwing: error!)
			continuation.resume(returning: response)

Weather Driver

My current personal project is codenamed Weather Driver. This is an iOS application targeted at Truck Drivers and other people who travel on the road. This application will allow them to better plan their trip around the weather. You will be able to enter your destination, chose a route, and then see the weather at various points thru-out the route.

This uses WeatherKit API from Apple, along with MapKit. This will have a server side component to handle getting the weather from Apple. The server side portion of this application will be written in Node.js.

How I decided to build this application, I drove 18-wheel for about 3 years. Part of my job as a Truck Driver was to plan my route based on the weather, I always found it tedious to check both the route I had to travel and the weather at multiple locations along the route.

I’ve been thinking about this project for over a year and finally have the tools to build it. Follow me as I build this project out and bring it to market. @JJAllenTech