Skip to content

404 error on sitemap.xml #70

Description

@cmotadev

Hi @giohappy,

I've found a problem on geonode's sitemap. There's a nginx issue that excludes sitemap.xml from available pages. This issue could be checked on GeoNode Demo. Screenshot below

Image

Checking the repo's geonode.conf, I've noted that has a misconfiguration on location / below. In lines 128-134, there's a location inside parent location. I noted that the location block's scope are isolated and the child location does not inherit parent's configuration. So this child location des not redirect to django, but goes to nginx's DocumentRoot.

location ~* \.(?:js|jpg|jpeg|gif|png|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|woff|woff2|svg|xml)$ {
gzip_static always;
expires 30d;
access_log off;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}

With DEBUG=True, the response is 404, and looking at allowed URLs, I noted thar robots.txt, sitemap.xml and version.txt are provided by django app.

Image

But all txt files are delivered but xml not.

  • robots.txt
Image

Suggestions to fix this problem

1- Remove XML off the regular expression (note that txt does not in regexp)

location ~* \.(?:js|jpg|jpeg|gif|png|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|ttf|rtf|swf|ico|flv|woff|woff2|svg|xml)$ {

2- Replace location to if statement (it works, too)

3- Rewrite all location / to use try_files and named locations (I used this), below
https://github.com/nds-cprm/geonode-docker/blob/46d231cd0277f69069d64fbb3f7db54650d1e6a8/docker/nginx/geonode.conf.envsubst#L87-L139

If solution 2 or 3 has been chosen, you should consider to replace the media and static locations.

Expected response

Image

[]s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions