Created
May 30, 2019 20:12
-
-
Save jonathangaldino/39e7927667e6180de50ad239b1277fd1 to your computer and use it in GitHub Desktop.
1/Allow CORS in Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name localhost; | |
listen 80 ; | |
access_log /var/log/nginx/access.log; | |
location / { | |
if ($request_method = OPTIONS) { | |
return 204; | |
} | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $server_name; | |
add_header 'Access-Control-Allow-Origin' '*' always; | |
add_header 'Access-Control-Allow-Credentials' 'true' always; | |
add_header 'Access-Control-Allow-Headers' 'Content-Type,Accept,Authorization' always; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; | |
proxy_pass http://grafana:3000; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.1" | |
services: | |
mysql: | |
image: mysql | |
container_name: englogic-mysql | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always | |
ports: | |
- 3306:3306 | |
volumes: | |
- englogic_mysql:/var/lib/mysql | |
#- ~/Documents/Englogic/sqls/PVs.sql:/queries | |
environment: | |
MYSQL_ROOT_PASSWORD: admin | |
MYSQL_DATABASE: englogic | |
MYSQL_USER: jonathan | |
MYSQL_PASSWORD: jonathan | |
adminer: | |
container_name: englogic-adminer | |
image: adminer | |
restart: always | |
ports: | |
- 8081:8080 | |
grafana: | |
image: grafana/grafana | |
container_name: englogic-grafana | |
restart: always | |
volumes: | |
- englogic_grafana:/var/lib/grafana | |
ports: | |
- 3000:3000 | |
environment: | |
- VIRTUAL_HOST=grafana.local | |
proxy: | |
image: nginx | |
container_name: englogic-proxy | |
restart: always | |
ports: | |
- 80:80 | |
links: | |
- grafana | |
volumes: | |
- ~/Documents/Englogic/grafana-mysql-setup/conf.d:/etc/nginx/conf.d | |
# - ~/Documents/Englogic/grafana-mysql-setup/vhost.d:/etc/nginx/vhost.d | |
volumes: | |
englogic_mysql: | |
external: false | |
englogic_grafana: | |
external: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment