disable CORS error
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 49s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 7s

This commit is contained in:
Mohamadzadeh 2026-07-09 16:33:21 +03:30
parent 1d78c19b1b
commit afdedd1216
2 changed files with 18 additions and 1 deletions

View File

@ -3,5 +3,7 @@ FROM docker.ibagher.ir/python:3.11-slim
WORKDIR /app
COPY ./dist ./dist
COPY ./main.py ./main.py
CMD ["python3", "-m", "http.server", "--bind", "0.0.0.0", "8000", "--directory", "./dist/remote"]
# CMD ["python3", "-m", "http.server", "--bind", "0.0.0.0", "8000", "--directory", "./dist/remote"]
CMD ["python3", "main.py"]

15
main.py Normal file
View File

@ -0,0 +1,15 @@
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
self.send_header("Access-Control-Allow-Headers", "Content-Type, Authorization")
super().end_headers()
def do_OPTIONS(self):
self.send_response(204)
self.end_headers()
server = ThreadingHTTPServer(("0.0.0.0", 8000), CORSRequestHandler)
server.serve_forever()