Skip to content

Latest NGINX equivalent for .htaccess to host a playground #1096

@0aveRyan

Description

@0aveRyan

Just dropping the config I used for an Nginx box, few of these would probably be good for self-hosting docs once that's more realistic in the future.

	location ~* .wasm$ {
	  types {
	    application/wasm wasm;
	  }
	}

	location ~* .data$ {
	  types {
	    application/octet-stream data;
	  }
	}

	location /scope:.* {
	  rewrite ^scope:.*?/(.*)$ $1 last;
	}

	# Enable Multiviews equivalent
	location / {
	    try_files $uri $uri/ @rewrite;
	}

	location @rewrite {
	    rewrite ^/(.*)$ /index.php?q=$1;
	}

	# Add gzip encoding for .gz files
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

	# Remove ETag and set Cache-Control for index.html
	location ~* ^/index\.html$ {
	    add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
	    add_header Pragma "no-cache";
	    add_header Expires "Wed, 11 Jan 1984 05:00:00 GMT";
	}

	# Set Access-Control-Allow-Origin and remove ETag, set Cache-Control for specific files
	location ~* ^/(index\.js|blueprint-schema\.json|wp-cli\.phar)$ {
	    add_header Access-Control-Allow-Origin "*";
	    add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
	    add_header Pragma "no-cache";
	    add_header Expires "Wed, 11 Jan 1984 05:00:00 GMT";
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions