Configuring static website on OpenStack Swift to use Cloudflare

I have a static website hosted on OpenStack Swift (an object store similar to Amazon S3), but cannot make it work with Cloudflare.

I configured Cloudflare DNS with a CNAME pointing to my object store, but I am either getting Not Found or Bad URL errors, when trying to access to https://<my_domain>/ or https://<my_domain>/index.html respectively:

Screenshot 2020-05-12 at 14.34.18

Any idea why this doesn’t work? I see Cloudflare works well with Amazon S3, but couldn’t find any article on the web about OpenStack Swift + Cloudflare.

That server wont be properly configured for your domain. It needs to be configured to answer for your domain as well as have a certificate valid for your domain. Pause Cloudflare, make sure it is properly configured, and only then unpause Cloudflare.

Hmmm, I’m afraid I don’t understand what you mean.

I don’t have any control on the server, as it is an object store (i.e., bucket).

When I add a CNAME towards this object store in Cloudflare DNS:

  • if I enable Cloudlfare Proxy, then I get errors.
  • if I disable Cloudflare Proxy, then it works.

In that case you wont be able to use Cloudflare. The server needs to respond to your domain.

Whats the domain and whats the server IP address?

Here is a subdomain with Proxy activated on Cloudflare dashboard: (it doesn’t work).

Here is a subdomain with DNS only set on Cloudflare dashboard: (it works).

And “proxy” points to the same address as “dnsonly”?

Not a proxy issue, sending the request to your server returns the same

$ curl --resolve
<html><h1>Not Found</h1><p>The resource could not be found.</p></html>

Yes, proxy points to the exact same address than dnsonly.

Alright, in that case it is your server configuration.

Again, I don’t own any server. I am using an Object Store. What setting do you think I should change on OpenStack Swift to make it work?

I see that Cloudflare is adding a Set-Cookie header when querying the proxy subdomain:

HTTP/1.1 404 Not Found
Date: Tue, 12 May 2020 18:35:21 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Set-Cookie: __cfduid=db49820d25369c6bddf6d7d22b5c94f0f1589308521; expires=Thu, 11-Jun-20 18:35:21 GMT; path=/;; HttpOnly; SameSite=Lax
X-Trans-Id: txfed2c683d60c4840a6553-005ebaec69
X-Openstack-Request-Id: txfed2c683d60c4840a6553-005ebaec69
X-IPLB-Instance: 33618
CF-Cache-Status: DYNAMIC
Server: cloudflare
CF-RAY: 59263d31bea1fa60-AMS
cf-request-id: 02abc493140000fa60c5165200000001

Here are the headers returned when querying the dnsonly subdomain for comparison:

HTTP/1.1 200 OK
Content-Length: 313
Accept-Ranges: bytes
Last-Modified: Tue, 12 May 2020 16:19:03 GMT
Etag: 8c730d91d7a74c5aba0cd1093c63e04b
X-Timestamp: 1589300342.15130
Content-Type: text/html
X-Trans-Id: tx61a46b40d86d4279b1a48-005ebaec60
X-Openstack-Request-Id: tx61a46b40d86d4279b1a48-005ebaec60
Date: Tue, 12 May 2020 18:35:13 GMT
X-IPLB-Instance: 12309

I will ask in parallel on an OpenStack forum to see if someone else already had this problem.

Whether you own the server or not does not matter, you need to fix the configuration. You need to address my earlier reply

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.